Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildSplit(templateData, options) {
var additionalOptions = {
helper: path.join(__dirname, 'helpers.js'),
partial: path.join(__dirname, 'partials/*.hbs')
};
// Create main index file
return dmd.async(templateData, Object.assign({}, options, additionalOptions, {
data: templateData,
template: '# cwlogs-writable ' + (includeProtected ? 'Extended API' : 'API') + '\n\n{{>main-index}}'
}))
.then(function(output) {
return new Promise(function(resolve, reject) {
fs.writeFile(path.join(outputPath, 'README.md'), output, function(err) {
if (err) {
reject(err);
}
else {
resolve();
}
});
});
})
.then(function() {
.then(function(templateREADME) {
// Create project README
return dmd.async(templateData, Object.assign({}, options, additionalOptions, {
data: templateData,
template: templateREADME
}))
})
.then(function(output) {
function renderMemberListDescription(text: string, indent: string) {
let data: string = dmdHelper.inlineLinks(text)
.replace(/<br>/g, "\n")
.replace(/\n/g, "\n" + indent)
.replace(new RegExp("\\*{2}\\\\/", "g"), "**/")
.trim()
if (data.includes("\n")) {
// mkdocs requires newline for multi line list item text (otherwise next item on the same line and rendered as list item)
data += "\n"
}
return data
}
return this.getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
value: function render(options) {
options = options || {};
var dmdOptions = new DmdOptions(options);
if (options.data) {
return dmd.async(options.data, dmdOptions);
} else {
return this.getTemplateData(options).then(function (templateData) {
return dmd.async(templateData, dmdOptions);
});
}
}
}, {
.map(async ([filename, contents]) => {
if (filename === "orphans.md") {
log.warn("Orphans found!");
contents.forEach(item => log.warn(item.longname, item.meta && `${item.meta.filename}:${item.meta.lineno}`));
}
contents.fullIndex = index;
const output = await dmd.async(contents, {
...options,
"member-index-format": "list"
});
return new Vinyl({
path: filename,
contents: Buffer.from(output)
});
})
.catch((err) => {
render (options) {
options = options || {}
const dmdOptions = new DmdOptions(options)
if (options.data) {
return dmd.async(options.data, dmdOptions)
} else {
return this.getTemplateData(options)
.then(templateData => dmd.async(templateData, dmdOptions))
}
}
function buildUnified(templateData, options) {
return dmd.async(templateData, Object.assign({}, options, {
'param-list-format': 'list',
data: templateData
}))
.then(function(output) {
return new Promise(function(resolve, reject) {
fs.writeFile(outputPath, output, function(err) {
if (err) {
reject(err);
}
else {
resolve();
}
});
});
});
}
.then(templateData => dmd.async(templateData, dmdOptions))
}
function parseLink(text) {
return dmdHelpers.parseLink(text)
}