Merge pull request #875 from showdownjs/develop

Develop
This commit is contained in:
Devyn S 2021-11-12 10:05:38 -07:00 committed by GitHub
commit d5cc678941
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 70 additions and 1 deletions

View File

@ -353,6 +353,8 @@ var defaultOptions = showdown.getDefaultOptions();
* **underline**: (boolean) [default false] ***EXPERIMENTAL FEATURE*** Enable support for underline. * **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>`. 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, * **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) including `<html>`, `<head>` and `<body>` tags' instead of an HTML fragment. (since v.1.8.5)

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -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>`', 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' type: 'boolean'
}, },
ellipsis: {
defaultValue: true,
description: 'Replaces three dots with the ellipsis unicode character',
type: 'boolean'
},
completeHTMLDocument: { completeHTMLDocument: {
defaultValue: false, defaultValue: false,
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags', description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',

View File

@ -1,6 +1,10 @@
showdown.subParser('makehtml.ellipsis', function (text, options, globals) { showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
'use strict'; 'use strict';
if (!options.ellipsis) {
return text;
}
text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals).getText(); text = globals.converter._dispatch('makehtml.ellipsis.before', text, options, globals).getText();
text = text.replace(/\.\.\./g, '…'); text = text.replace(/\.\.\./g, '…');

View File

@ -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>

View 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")

View File

@ -17,3 +17,4 @@
<li>..</li> <li>..</li>
</ol> </ol>
<p>1…</p> <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>

View File

@ -20,3 +20,5 @@ ellipsis in code...
1. .. 1. ..
1... 1...
[Link](https://gitlab.com/gitlab-org/gitlab-ce/compare/v11.5.4...v11.5.5 "title")

View File

@ -13,6 +13,7 @@ var bootstrap = require('./makehtml.bootstrap.js'),
rawPrefixHeaderIdSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/rawPrefixHeaderId/'), rawPrefixHeaderIdSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/rawPrefixHeaderId/'),
emojisSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/emojis/'), emojisSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/emojis/'),
underlineSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/underline/'), 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/'), literalMidWordUnderscoresSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordUnderscores/'),
//literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'), //literalMidWordAsterisksSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/literalMidWordAsterisks/'),
completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'), completeHTMLOutputSuite = bootstrap.getTestSuite('test/functional/makehtml/cases/features/completeHTMLOutput/'),
@ -215,6 +216,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 **/ /** test literalMidWordUnderscores option **/
describe('literalMidWordUnderscores option', function () { describe('literalMidWordUnderscores option', function () {
var converter, var converter,