I'm not quite sure what is going on here, but it distorted me a little. The marked
node markdown parameter works as follows:
var marked = require('marked'); marked.setOptions({ mathjax : false });
It all works. But I am creating a plug-in system where I want to transfer the marked function of the module to a function from another file and set the parameters in this function:
// main.js var marked = require('marked'); var plugin = require('./plugin'); plugin(marked); marked("# my markdown\n $$5 + 5$$", function(err, result) { // this result still parses mathjax. Setting the option in the main // file will disable mathjax. console.log(result); }); // plugin.js module.exports = function(marked) { marked.setOptions({ mathjax: false }); }
The marked
function is passed correctly to my plugin function, and the setOptions
function is setOptions
, but when I use marked
subsequently in my main script, no parameters are set. If I set the parameters in the main script, it will work.
I'm a little unsure that marked
is Function
, and its implementation of setOptions()
might be the culprit of this?
Any thoughts?
source share