angular-cn/tools/docs/content-package/readers/content.js

26 lines
620 B
JavaScript

var path = require('canonical-path');
/**
* @dgService
* @description
* This file reader will pull the contents from a text file (by default .md)
*
* The doc will initially have the form:
* ```
* {
* content: 'the content of the file',
* startingLine: 1
* }
* ```
*/
module.exports = function contentFileReader() {
return {
name: 'contentFileReader',
defaultPattern: /\.md$/,
getDocs: function(fileInfo) {
// We return a single element array because content files only contain one document
return [{docType: 'guide', content: fileInfo.content, startingLine: 1}];
}
};
};