Comparing version 0.0.4 to 0.0.5
@@ -7,3 +7,2 @@ var __extends = this.__extends || function (d, b) { | ||
}; | ||
var Theme = (function (_super) { | ||
@@ -14,171 +13,4 @@ __extends(Theme, _super); | ||
} | ||
Theme.prototype.isOutputDirectory = function (dirname) { | ||
if (!FS.existsSync(Path.join(dirname, 'index.html'))) | ||
return false; | ||
if (!FS.existsSync(Path.join(dirname, 'assets'))) | ||
return false; | ||
if (!FS.existsSync(Path.join(dirname, 'assets', 'js', 'main.js'))) | ||
return false; | ||
if (!FS.existsSync(Path.join(dirname, 'assets', 'images', 'icons.png'))) | ||
return false; | ||
return true; | ||
}; | ||
Theme.prototype.getMapping = function (reflection) { | ||
for (var i = 0, c = Theme.MAPPINGS.length; i < c; i++) { | ||
var mapping = Theme.MAPPINGS[i]; | ||
if (reflection.kindOf(mapping.kind)) { | ||
return mapping; | ||
} | ||
} | ||
return null; | ||
}; | ||
Theme.prototype.initialize = function () { | ||
this.project.reflections.forEach(function (reflection) { | ||
var classes = []; | ||
var kind = TypeDoc.Models.Kind[reflection.kind]; | ||
classes.push(Theme.classify('tsd-kind-' + kind)); | ||
if (reflection.parent && reflection.parent instanceof TypeDoc.Models.DeclarationReflection) { | ||
kind = TypeDoc.Models.Kind[reflection.parent.kind]; | ||
classes.push(Theme.classify('tsd-parent-kind-' + kind)); | ||
} | ||
if (reflection.overwrites) | ||
classes.push('tsd-is-overwrite'); | ||
if (reflection.inheritedFrom) | ||
classes.push('tsd-is-inherited'); | ||
if (reflection.isPrivate) | ||
classes.push('tsd-is-private'); | ||
if (reflection.isStatic) | ||
classes.push('tsd-is-static'); | ||
if (!reflection.isExported) | ||
classes.push('tsd-is-not-exported'); | ||
reflection.cssClasses = classes.join(' '); | ||
if (reflection.groups) { | ||
reflection.groups.forEach(function (group) { | ||
var classes = []; | ||
if (group.allChildrenAreInherited) | ||
classes.push('tsd-is-inherited'); | ||
if (group.allChildrenArePrivate) | ||
classes.push('tsd-is-private'); | ||
if (!group.allChildrenAreExported) | ||
classes.push('tsd-is-not-exported'); | ||
group.cssClasses = classes.join(' '); | ||
}); | ||
} | ||
}); | ||
}; | ||
Theme.prototype.getUrls = function () { | ||
var _this = this; | ||
var urls = []; | ||
var createUrl = function (reflection, to, separator) { | ||
if (typeof separator === "undefined") { separator = '.'; } | ||
var url = reflection.getAlias(); | ||
if (reflection.parent && reflection.parent != to && !(reflection.parent instanceof TypeDoc.Models.ProjectReflection)) { | ||
url = createUrl(reflection.parent, to, separator) + separator + url; | ||
} | ||
return url; | ||
}; | ||
var walkLeaf = function (reflection, container) { | ||
reflection.children.forEach(function (child) { | ||
if (child.kindOf(TypeDoc.Models.Kind.Parameter)) { | ||
return; | ||
} | ||
child.url = container.url + '#' + createUrl(child, container, '.'); | ||
walkLeaf(child, container); | ||
}); | ||
}; | ||
var walkReflection = function (reflection, container) { | ||
reflection.children.forEach(function (child) { | ||
var mapping = _this.getMapping(child); | ||
if (mapping) { | ||
child.url = Path.join(mapping.prefix, createUrl(child) + '.html'); | ||
child.hasOwnDocument = true; | ||
urls.push(new TypeDoc.Models.UrlMapping(child.url, child, mapping.template)); | ||
if (mapping.isLeaf) { | ||
walkLeaf(child, child); | ||
} else { | ||
walkReflection(child, child); | ||
} | ||
} else { | ||
child.url = container.url + '#' + createUrl(child, container, '.'); | ||
walkLeaf(child, container); | ||
} | ||
}); | ||
}; | ||
this.project.url = 'globals.html'; | ||
urls.push(new TypeDoc.Models.UrlMapping('globals.html', this.project, 'reflection.hbs')); | ||
urls.push(new TypeDoc.Models.UrlMapping('index.html', this.project, 'index.hbs')); | ||
walkReflection(this.project, this.project); | ||
return urls; | ||
}; | ||
Theme.prototype.getNavigation = function () { | ||
function walkReflection(reflection, parent) { | ||
var name = parent == root ? reflection.getFullName() : reflection.name; | ||
var item = new TypeDoc.Models.NavigationItem(name, reflection.url, parent); | ||
item.isPrimary = (parent == root); | ||
item.cssClasses = reflection.cssClasses; | ||
reflection.children.forEach(function (child) { | ||
if (child.kindOf(TypeDoc.Models.Kind.SomeContainer)) | ||
return; | ||
walkReflection(child, item); | ||
}); | ||
} | ||
var root = new TypeDoc.Models.NavigationItem('Index', 'index.html'); | ||
new TypeDoc.Models.NavigationItem('<em>Globals</em>', 'globals.html', root); | ||
var modules = this.project.getReflectionsByKind(TypeDoc.Models.Kind.SomeContainer); | ||
modules.forEach(function (container) { | ||
return walkReflection(container, root); | ||
}); | ||
return root; | ||
}; | ||
Theme.classify = function (str) { | ||
return str.replace(/(\w)([A-Z])/g, function (m, m1, m2) { | ||
return m1 + '-' + m2; | ||
}).toLowerCase(); | ||
}; | ||
Theme.MAPPINGS = [ | ||
{ | ||
kind: TypeDoc.Models.Kind.Class, | ||
isLeaf: true, | ||
prefix: 'classes', | ||
template: 'reflection.hbs' | ||
}, { | ||
kind: TypeDoc.Models.Kind.Interface, | ||
isLeaf: true, | ||
prefix: 'interfaces', | ||
template: 'reflection.hbs' | ||
}, { | ||
kind: TypeDoc.Models.Kind.Enum, | ||
isLeaf: true, | ||
prefix: 'enums', | ||
template: 'reflection.hbs' | ||
}, { | ||
kind: [TypeDoc.Models.Kind.Container, TypeDoc.Models.Kind.DynamicModule], | ||
isLeaf: false, | ||
prefix: 'modules', | ||
template: 'reflection.hbs' | ||
}]; | ||
return Theme; | ||
})(TypeDoc.Renderer.BaseTheme); | ||
})(TypeDoc.Output.DefaultTheme); | ||
exports.Theme = Theme; |
{ | ||
"name": "typedoc", | ||
"description": "Create api documentations for typescript projects.", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"bin": { | ||
"typedoc" : "bin/typedoc" | ||
"typedoc": "bin/typedoc" | ||
}, | ||
@@ -31,2 +31,3 @@ "author": { | ||
"fs.extra": "~1.2.1", | ||
"minimatch": "^0.3.0", | ||
"handlebars": "^2.0.0-alpha.4", | ||
@@ -44,5 +45,2 @@ "marked": "^0.3.2", | ||
}, | ||
"scripts": { | ||
"test": "node test/testrunner.js" | ||
}, | ||
"files": [ | ||
@@ -49,0 +47,0 @@ "bin", |
@@ -11,3 +11,3 @@ # TypeDoc | ||
```shell | ||
```bash | ||
$ npm install typedoc --save-dev | ||
@@ -19,3 +19,3 @@ ``` | ||
```shell | ||
```bash | ||
$ npm install typedoc --global | ||
@@ -43,3 +43,3 @@ $ typedoc | ||
```shell | ||
```bash | ||
$ typedoc --out path/to/documentation/ path/to/typescript/project/ | ||
@@ -50,15 +50,43 @@ ``` | ||
#### ```--out <path/to/documentation/>``` | ||
`--out <path/to/documentation/>` | ||
Specifies the location the documentation should be written to. | ||
#### ```--title <Documentation title>``` | ||
`--name <Documentation title>` | ||
Set the name of the project that will be used in the header of the template. | ||
#### ```--module <commonjs or amd>``` | ||
`--module <commonjs or amd>` | ||
Specify module code generation: "commonjs" or "amd" | ||
#### ```--target <ES3 or ES5>``` | ||
`--target <ES3 or ES5>` | ||
Specify ECMAScript target version: "ES3" (default), or "ES5" | ||
`--exclude <pattern>` | ||
Exclude files by the given pattern when a path is provided as source | ||
`--theme <path/to/theme>` | ||
Specify the path to the theme that should be used | ||
`--includeDeclarations` | ||
Turn on parsing of .d.ts declaration files. | ||
`--externalPattern <pattern>` | ||
Define a pattern for files that should be considered being external. | ||
`--excludeExternals` | ||
Prevent externally resolved TypeScript files from being documented. | ||
`--verbose` | ||
Print more information while TypeDoc is running. | ||
### Gulp | ||
@@ -70,2 +98,8 @@ | ||
### Grunt | ||
There is a plugin available to run TypeDoc with Grunt created by Bart van der Schoor. You can find it on NPM: | ||
https://www.npmjs.org/package/grunt-typedoc | ||
## Document your code | ||
@@ -77,2 +111,9 @@ | ||
All comments parsed as markdown. TypeDoc uses the Marked (https://github.com/chjj/marked) markdown parser | ||
and HighlightJS (https://github.com/isagalaev/highlight.js) to highlight code blocks within markdown sections. | ||
Additionally you can link to other classes, members or functions using double angle brackets. | ||
### JavaDoc tags | ||
The documentation generator currently understands these javadoc tags: | ||
@@ -84,1 +125,30 @@ | ||
All other tags will be rendered as definition lists, so they are not lost. | ||
### Function signatures | ||
When writing documentation for function signatures, you don't have to repeat yourself. TypeDoc automatically | ||
copies comments and tags of the function implementation to its signatures for you. Of course you can still | ||
overwrite them if you wish to. | ||
```typescript | ||
/** | ||
* @param text Comment for parameter ´text´. | ||
*/ | ||
function doSomething(target:any, text:string):number; | ||
/** | ||
* @param value Comment for parameter ´value´. | ||
* @returns Comment for special return value. | ||
*/ | ||
function doSomething(target:any, value:number):number; | ||
/** | ||
* Comment for method ´doSomething´. | ||
* @param target Comment for parameter ´target´. | ||
* @returns Comment for return value. | ||
*/ | ||
function doSomething(target:any, arg:any):number { | ||
return 0; | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
438899
8886
147
6
25
+ Addedminimatch@^0.3.0
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.3.0(transitive)
+ Addedsigmund@1.0.1(transitive)