mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Merge pull request #731 from VladimirV99/ellipsis
feature(ellipsis): Add option to disable ellipsis
This commit is contained in:
commit
6efd75cb83
|
@ -353,6 +353,8 @@ var defaultOptions = showdown.getDefaultOptions();
|
|||
* **underline**: (boolean) [default false] ***EXPERIMENTAL FEATURE*** Enable support for underline.
|
||||
Syntax is **double** or **triple** **underscores** ex: `__underlined word__`. With this option enabled, underscores are no longer parses into `<em>` and `<strong>`.
|
||||
|
||||
* **ellipsis**: (boolean) [default true] Replaces three dots with the ellipsis unicode character.
|
||||
|
||||
* **completeHTMLDocument**: (boolean) [default false] Outputs a complete html document,
|
||||
including `<html>`, `<head>` and `<body>` tags' instead of an HTML fragment. (since v.1.8.5)
|
||||
|
||||
|
|
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.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -146,6 +146,11 @@ function getDefaultOpts (simple) {
|
|||
description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
|
||||
type: 'boolean'
|
||||
},
|
||||
ellipsis: {
|
||||
defaultValue: true,
|
||||
description: 'Replaces three dots with the ellipsis unicode character',
|
||||
type: 'boolean'
|
||||
},
|
||||
completeHTMLDocument: {
|
||||
defaultValue: false,
|
||||
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
if (!options.ellipsis) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals).getText();
|
||||
|
||||
text = text.replace(/\.\.\./g, '…');
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<p>ellipsis in text...</p>
|
||||
<p>…</p>
|
||||
<ol>
|
||||
<li>foo...</li>
|
||||
<li>bar</li>
|
||||
</ol>
|
||||
<blockquote>
|
||||
<p>ellipsis in blockquote...</p>
|
||||
</blockquote>
|
||||
<pre><code>ellipsis in code...
|
||||
</code></pre>
|
||||
<pre><code>ellipsis in code...
|
||||
</code></pre>
|
||||
<h1 id="ellipsisinheader">ellipsis in header...</h1>
|
||||
<p>1...</p>
|
||||
<ol>
|
||||
<li>..</li>
|
||||
</ol>
|
||||
<p>1…</p>
|
||||
<p><a href="https://gitlab.com/gitlab-org/gitlab-ce/compare/v11.5.4...v11.5.5" title="title">Link</a></p>
|
24
test/functional/makehtml/cases/features/ellipsis/ellipsis.md
Normal file
24
test/functional/makehtml/cases/features/ellipsis/ellipsis.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
ellipsis in text...
|
||||
|
||||
…
|
||||
|
||||
1. foo...
|
||||
2. bar
|
||||
|
||||
> ellipsis in blockquote...
|
||||
|
||||
```
|
||||
ellipsis in code...
|
||||
```
|
||||
|
||||
ellipsis in code...
|
||||
|
||||
# ellipsis in header...
|
||||
|
||||
1...
|
||||
|
||||
1. ..
|
||||
|
||||
1…
|
||||
|
||||
[Link](https://gitlab.com/gitlab-org/gitlab-ce/compare/v11.5.4...v11.5.5 "title")
|
|
@ -17,3 +17,4 @@
|
|||
<li>..</li>
|
||||
</ol>
|
||||
<p>1…</p>
|
||||
<p><a href="https://gitlab.com/gitlab-org/gitlab-ce/compare/v11.5.4...v11.5.5" title="title">Link</a></p>
|
|
@ -19,4 +19,6 @@ ellipsis in code...
|
|||
|
||||
1. ..
|
||||
|
||||
1...
|
||||
1...
|
||||
|
||||
[Link](https://gitlab.com/gitlab-org/gitlab-ce/compare/v11.5.4...v11.5.5 "title")
|
|
@ -13,6 +13,7 @@ var bootstrap = require('./makehtml.bootstrap.js'),
|
|||
rawPrefixHeaderIdSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/rawPrefixHeaderId/'),
|
||||
emojisSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/emojis/'),
|
||||
underlineSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/underline/'),
|
||||
ellipsisSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/ellipsis/'),
|
||||
literalMidWordUnderscoresSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordUnderscores/'),
|
||||
//literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'),
|
||||
completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'),
|
||||
|
@ -213,6 +214,16 @@ describe('makeHtml() features testsuite', function () {
|
|||
}
|
||||
});
|
||||
|
||||
/** test ellipsis option **/
|
||||
describe('ellipsis option', function () {
|
||||
var converter,
|
||||
suite = ellipsisSuite;
|
||||
for (var i = 0; i < suite.length; ++i) {
|
||||
converter = new showdown.Converter({ellipsis: false});
|
||||
it(suite[i].name.replace(/-/g, ' '), assertion(suite[i], converter));
|
||||
}
|
||||
});
|
||||
|
||||
/** test literalMidWordUnderscores option **/
|
||||
describe('literalMidWordUnderscores option', function () {
|
||||
var converter,
|
||||
|
|
Loading…
Reference in New Issue
Block a user