Skip to content

Commit

Permalink
Added markdown js hooks for body
Browse files Browse the repository at this point in the history
  • Loading branch information
Phara0h committed Sep 12, 2019
1 parent c2d4d2a commit 68b02af
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,9 @@ var getDocs = function (name, description, url, body, headers = [])
if(body.mode == 'raw') {
docs +=
`
* @param {Object} body `
docs += beautify(body.raw,{format: 'json'}).replace(/\n/g, '\n * ');
}
else if(body.mode == 'urlencoded') {
urlVars = Array.from(body.urlencoded.map(v => v.key.length > 0 ? v.key : null)).filter(v=>v);
}
* @param {Object} body`
}
}

var varsString = '';

Expand Down Expand Up @@ -195,6 +191,24 @@ if(urlVars.length > 0) {
}
}
}



if(body) {
if(body.mode == 'raw') {
docs +=
`
* @example
* body
* \`\`\`js
* `
docs += beautify(body.raw,{format: 'json'}).replace(/\n/g, '\n * ');
docs += '\n * ```';
}
else if(body.mode == 'urlencoded') {
urlVars = Array.from(body.urlencoded.map(v => v.key.length > 0 ? v.key : null)).filter(v=>v);
}
}
docs +=
`
*/`
Expand Down

0 comments on commit 68b02af

Please sign in to comment.