Articles rendering system

This commit is contained in:
Clément GOUIN
2019-06-20 13:49:44 +02:00
parent 69d05e3900
commit b7a2fd0740
7 changed files with 131 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
const fs = require('fs');
const showdown = require('showdown');
module.exports = (config) => {
const converter = new showdown.Converter(config['showdown']);
return {
render : (file, cb) => {
fs.readFile(file, {encoding:'UTF-8'}, (err, data) => {
if(err)
return cb(err);
const html = converter.makeHtml(data);
cb(null,html);
});
}
};
};