From 1d3f306fb84cfb7366a194164ca3403906b14ffc Mon Sep 17 00:00:00 2001 From: Benjamin Horsleben Date: Tue, 11 Dec 2012 19:02:44 +0100 Subject: [PATCH] Added support for ender. - It defines everything to look and act like node, which makes `require('fs')` throw an exception (unloaded module). --- src/showdown.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/showdown.js b/src/showdown.js index b488bad..7a57977 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -117,8 +117,11 @@ var g_output_modifiers = []; // Automatic Extension Loading (node only): // -if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof require !== 'undefind') { - var fs = require('fs'); +if (typeof module !== 'undefined' && typeof exports !== 'undefined' && typeof require !== 'undefined') { + var fs; + try { + fs = require('fs'); + } catch(e) {} if (fs) { // Search extensions folder