Pete Bacon Darwin 62aca30286 feat(docs-infra): add support for "special elements" (#41299)
This commit adds support for generating pages that document
special Angular elements, such as `ng-content` and `ng-template`,
which have special behavior in Angular but are not directives nor
components.

Resolves #41273

PR Close #41299
2021-06-16 14:01:16 -07:00

29 lines
767 B
JavaScript

/**
* @dgService
* @description
* This file reader will pull the contents from a text file that will be used
* as the description of a "special element", such as `<ng-content>` or `<ng-template>`, etc.
*
* The doc will initially have the form:
* ```
* {
* docType: 'element',
* name: 'some-name',
* content: 'the content of the file',
* }
* ```
*/
module.exports = function specialElementFileReader() {
return {
name: 'specialElementFileReader',
defaultPattern: /\.md$/,
getDocs: function(fileInfo) {
// We return a single element array because element files only contain one document
return [{
docType: 'element',
name: `<${fileInfo.baseName}>`,
content: fileInfo.content,
}];
}
};
};