|
@@ -196,15 +196,6 @@ function allOptionsOn () {
|
|
/**
|
|
/**
|
|
* Created by Tivie on 06-01-2015.
|
|
* Created by Tivie on 06-01-2015.
|
|
*/
|
|
*/
|
|
-
|
|
|
|
-// load dependencies
|
|
|
|
-if (typeof document === 'undefined' && typeof window === 'undefined') {
|
|
|
|
- var jsdom = require('jsdom').jsdom,
|
|
|
|
- jsdomObj = jsdom('', {}),
|
|
|
|
- window = jsdomObj.defaultView, // jshint ignore:line
|
|
|
|
- document = window.document; // jshint ignore:line
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// Private properties
|
|
// Private properties
|
|
var showdown = {},
|
|
var showdown = {},
|
|
parsers = {},
|
|
parsers = {},
|
|
@@ -590,6 +581,11 @@ if (!showdown.hasOwnProperty('helper')) {
|
|
showdown.helper = {};
|
|
showdown.helper = {};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+if (typeof this.document === 'undefined' && typeof this.window === 'undefined') {
|
|
|
|
+ this.window = require('jsdom').jsdom('', {}).defaultView; // jshint ignore:line
|
|
|
|
+}
|
|
|
|
+showdown.helper.document = this.window.document;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Check if var is string
|
|
* Check if var is string
|
|
* @static
|
|
* @static
|
|
@@ -4394,7 +4390,7 @@ showdown.Converter = function (converterOptions) {
|
|
// ex: <em>this is</em> <strong>sparta</strong>
|
|
// ex: <em>this is</em> <strong>sparta</strong>
|
|
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
|
|
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
|
|
|
|
|
|
- var doc = document.createElement('div');
|
|
|
|
|
|
+ var doc = showdown.helper.document.createElement('div');
|
|
doc.innerHTML = src;
|
|
doc.innerHTML = src;
|
|
|
|
|
|
var preList = substitutePreCodeTags(doc);
|
|
var preList = substitutePreCodeTags(doc);
|