From 3af37602632d7212ff3ece8aec990df6fb641bf6 Mon Sep 17 00:00:00 2001 From: kapil verma Date: Tue, 13 May 2014 05:32:20 +0530 Subject: [PATCH] make compatible with browserify added ability to disable extensions search on node so that the call to `fs.readdirSync` can be disabled when showdowns is being used with browserify (because that call cannot be handled by browserify) --- src/showdown.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/showdown.js b/src/showdown.js index 8645171..ce3618e 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -95,6 +95,9 @@ var stdExtName = function(s) { // Showdown.converter = function(converter_options) { +// set converter_options to a plain object if its undefined +converter_options = converter_options === undefined ? {} : converter_options + // // Globals: // @@ -117,7 +120,7 @@ var g_output_modifiers = []; // Automatic Extension Loading (node only): // -if (typeof module !== 'undefined' && typeof exports !== 'undefined' && typeof require !== 'undefind') { +if (converter_options.node !== false && typeof module !== 'undefined' && typeof exports !== 'undefined' && typeof require !== 'undefind') { var fs = require('fs'); if (fs) {