Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
755 B

  1. const pandoc = require('node-pandoc');
  2. // const args = '-t html5';
  3. const args = '-S --base-header-level=1 --toc --toc-depth=6 -N --normalize -s --mathjax -t html5';
  4. console.log("");
  5. module.exports=
  6. {
  7. convertToHTML: function(markdownContents)
  8. {
  9. return new Promise(function(resolve, reject)
  10. {
  11. // Set your callback function
  12. callback = function (err, result)
  13. {
  14. if (err)
  15. {
  16. reject(err);
  17. }
  18. resolve(result);
  19. };
  20. console.log(markdownContents);
  21. pandoc(markdownContents, args, callback);
  22. });
  23. },
  24. }