angular/aio/tools/transforms/angular-api-package/readers/block.js
Jeremy Elbourn a49ee46dae docs(docs-infra): add support for block syntax to dgeni (#52123)
This adds the new block syntax to dgeni docs pipeline, mainly copying
the way that elements (`<ng-content>` etc.) work. Actual doc content is
just a placeholder for this PR.

PR Close #52123
2023-10-10 13:55:04 -07:00

29 lines
717 B
JavaScript

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