a4f3f3f81d
Now, one can add an `@alias` tag to API docs, which tells dgeni that this API element (usually a `const`) is really just an alias for some API element defined elsewhere. Dgeni will then look up this API element and copy over the properties from the alias to the current doc. For example, we would like to privately export an Enum from `@angular/core` but then publicly export this from `@angular/common`: **packages/core/private_exports.ts** ```ts /** * Description of this document. */ export enum ɵSomeEnum { ... } ``` **packages/common/public_api.ts** ```ts import {ɵSomeEnum} from '@angular/core'; /** * @alias core/ɵSomeEnum */ export const SomeEnum = ɵSomeEnum; ``` In the generated docs there will be a page for `common/SomeEnum`, which will be rendered as an enum, rather than a const, showing the description extracted from the `core/ɵSomeEnum`. --- The implementation of this feature required some refactoring of the other processing: 1. Previously `ɵ` prefixed exports were not even considered. 2. Due to 1. some processors needed to have guards added to ignore such private exports (`addMetadataAliases` and `checkContentRules`). 3. The processing of package pages had to be reworked (and split) so that it picked up the aliased export docs after their alias proeprties had been copied. See FW-1207, FW-632, #29249 PR Close #29673 |
||
---|---|---|
.. | ||
api | ||
cli | ||
lib | ||
README.md | ||
content.template.html | ||
data-module.template.js | ||
example-region.template.html | ||
json-doc.template.json | ||
overview-dump.template.html | ||
sitemap.template.xml |
README.md
This folder contains the dgeni templates that are used to generate the API docs
Generally there is a template for each docType. Templates can extend and/or include other templates. Templates can also import macros from other template files.
Template inheritance
When extending a template, parent must declare blocks that can be overridden by the child. The template extension hierarchy looks like this (with declared blocks in parentheses):
- layout/base.template.html (bread-crumbs, header, embedded contents and body)
- package.template.html
- export-base.template.html (short-description, security-notes, deprecation, overview, see-also, details, usageNotes)
- class.template.html
- directive.template.html
- enum.template.html
- var.template.html
- const.template.html
- let.template.html
- decorator.template.html
- function.template.html
- interface.template.html
- value-module.template.html
- type-alias.template.html
- pipe.template.html
- ngmodule.template.html
- class.template.html
Doc Properties
It is useful to know what properties are available on each doc type when working with the templates.
The typescript
Dgeni package is now written in TypeScript and there is a class for each of the types of
API document. See https://github.com/angular/dgeni-packages/tree/master/typescript/src/api-doc-types.
This is a good place to go to see what properties you can use in the templates.