crosspost
Version:
CrossPost allows you to write your articles in markdown once and push publish them on different platforms like webflow, dev.to, GitHub & more in one go!
21 lines (18 loc) • 602 B
JavaScript
const files = require('./files')
module.exports = {
toHtml: async (markdown) => {
const showdown = require('showdown')
const showdownConverter = new showdown.Converter()
showdownConverter.setFlavor('github')
return showdownConverter.makeHtml(markdown)
},
getHtml: async (path) => {
const markdown = await files.getFile(path)
return await module.exports.toHtml(markdown)
},
getHtmlWithoutTitle: async (path) => {
let markdown = await files.getFile(path)
markdown = await files.removeFirstLine(markdown)
return await module.exports.toHtml(markdown)
}
}