|
@@ -1,4 +1,4 @@
|
|
-;/*! showdown 13-05-2016 */
|
|
|
|
|
|
+;/*! showdown 07-06-2016 */
|
|
(function(){
|
|
(function(){
|
|
/**
|
|
/**
|
|
* Created by Tivie on 13-07-2015.
|
|
* Created by Tivie on 13-07-2015.
|
|
@@ -72,6 +72,11 @@ function getDefaultOpts(simple) {
|
|
default: false,
|
|
default: false,
|
|
describe: 'Prevents weird effects in live previews due to incomplete input',
|
|
describe: 'Prevents weird effects in live previews due to incomplete input',
|
|
type: 'boolean'
|
|
type: 'boolean'
|
|
|
|
+ },
|
|
|
|
+ smartIndentationFix: {
|
|
|
|
+ default: false,
|
|
|
|
+ description: 'Tries to smartly fix identation in es6 strings',
|
|
|
|
+ type: 'boolean'
|
|
}
|
|
}
|
|
};
|
|
};
|
|
if (simple === false) {
|
|
if (simple === false) {
|
|
@@ -876,6 +881,12 @@ showdown.Converter = function (converterOptions) {
|
|
listeners[name].push(callback);
|
|
listeners[name].push(callback);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function rTrimInputText(text) {
|
|
|
|
+ var rsp = text.match(/^\s*/)[0].length,
|
|
|
|
+ rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
|
|
|
|
+ return text.replace(rgx, '');
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Dispatch an event
|
|
* Dispatch an event
|
|
* @private
|
|
* @private
|
|
@@ -949,6 +960,10 @@ showdown.Converter = function (converterOptions) {
|
|
text = text.replace(/\r\n/g, '\n'); // DOS to Unix
|
|
text = text.replace(/\r\n/g, '\n'); // DOS to Unix
|
|
text = text.replace(/\r/g, '\n'); // Mac to Unix
|
|
text = text.replace(/\r/g, '\n'); // Mac to Unix
|
|
|
|
|
|
|
|
+ if (options.smartIndentationFix) {
|
|
|
|
+ text = rTrimInputText(text);
|
|
|
|
+ }
|
|
|
|
+
|
|
// Make sure text begins and ends with a couple of newlines:
|
|
// Make sure text begins and ends with a couple of newlines:
|
|
text = '\n\n' + text + '\n\n';
|
|
text = '\n\n' + text + '\n\n';
|
|
|
|
|
|
@@ -2517,4 +2532,4 @@ if (typeof module !== 'undefined' && module.exports) {
|
|
}
|
|
}
|
|
}).call(this);
|
|
}).call(this);
|
|
|
|
|
|
-//# sourceMappingURL=showdown.js.map
|
|
|
|
|
|
+//# sourceMappingURL=showdown.js.map
|