1
0
mirror of https://github.com/namibia/tips.git synced 2024-11-18 02:55:16 +00:00
git-tips/.doxie.render.js
2015-07-17 13:01:25 +05:30

25 lines
487 B
JavaScript

function escapeStr(str) {
return str
.replace(/\"/g, '\\"')
.replace(/\n/g, '\\n');
}
var render = function(data) {
var data = data.data;
var tips = [
'## ' + data.title,
'```sh',
data.tip,
'```',
'\n'
];
Array.isArray(data.alternatives) && tips.push(['__Alternatives:__']) &&
data.alternatives.map(function(alternative){
tips = tips.concat(['```sh',alternative,'```','\n'])
});
return tips.join('\n');
};
module.exports = render;