fix(aio): convert API and content docs to JSON

This commit is contained in:
Peter Bacon Darwin
2017-02-21 16:57:19 +00:00
committed by Igor Minar
parent 5e9474d24c
commit dfed388139
3 changed files with 32 additions and 4 deletions

View File

@ -0,0 +1,20 @@
module.exports = function convertToJsonProcessor() {
return {
$runAfter: ['checkUnbalancedBackTicks'],
$runBefore: ['writeFilesProcessor'],
docTypes: [],
$process: function(docs) {
const docTypes = this.docTypes
docs.forEach((doc) => {
if (docTypes.indexOf(doc.docType) !== -1) {
const output = {
title: doc.title || doc.name,
content: doc.renderedContent
};
doc.renderedContent = JSON.stringify(output, null, 2);
}
});
}
};
};