mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
parent
e586201025
commit
261f127f7e
|
@ -252,6 +252,8 @@ var defaultOptions = showdown.getDefaultOptions();
|
||||||
```
|
```
|
||||||
* **smoothLivePreview**: (boolean) [default false] Prevents weird effects in live previews due to incomplete input
|
* **smoothLivePreview**: (boolean) [default false] Prevents weird effects in live previews due to incomplete input
|
||||||
|
|
||||||
|
* **smartIndentationFix**: (boolean) [default false] Tries to smartly fix indentation problems related to es6 template strings in the midst of indented code.
|
||||||
|
|
||||||
## CLI Tool
|
## CLI Tool
|
||||||
|
|
||||||
Showdown also comes bundled with a Command Line Interface tool. You can check the [CLI wiki page][cli-wiki] for more info
|
Showdown also comes bundled with a Command Line Interface tool. You can check the [CLI wiki page][cli-wiki] for more info
|
||||||
|
|
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
|
@ -189,6 +189,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
|
||||||
|
@ -262,6 +268,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';
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,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) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<h2 id="markdowndoc">markdown doc</h2>
|
||||||
|
|
||||||
|
<p>you can use markdown for card documentation</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>foo</li>
|
||||||
|
|
||||||
|
<li>bar</li>
|
||||||
|
</ul>
|
|
@ -0,0 +1,5 @@
|
||||||
|
## markdown doc
|
||||||
|
|
||||||
|
you can use markdown for card documentation
|
||||||
|
- foo
|
||||||
|
- bar
|
|
@ -29,6 +29,8 @@ describe('makeHtml() features testsuite', function () {
|
||||||
converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true});
|
converter = new showdown.Converter({literalMidWordUnderscores: true, simplifiedAutoLink: true});
|
||||||
} else if (testsuite[i].name === '#198.literalMidWordUnderscores-changes-behavior-of-asterisk') {
|
} else if (testsuite[i].name === '#198.literalMidWordUnderscores-changes-behavior-of-asterisk') {
|
||||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||||
|
} else if (testsuite[i].name === '#259.es6-template-strings-indentation-issues') {
|
||||||
|
converter = new showdown.Converter({smartIndentationFix: true});
|
||||||
} else {
|
} else {
|
||||||
converter = new showdown.Converter();
|
converter = new showdown.Converter();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user