fix(metadata): allow whitespaces after closing marks

Co-authored-by: Estevão Soares dos Santos <estevao.santos@gmail.com>
This commit is contained in:
Swain 2022-03-26 05:55:19 +09:00 committed by GitHub
parent 3eff10bbbf
commit 0d3ca4da5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 9847 deletions

9911
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -34,12 +34,12 @@ showdown.subParser('makehtml.metadata', function (text, options, globals) {
});
}
text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
text = text.replace(/^\s*«««+\s*(\S*?)\n([\s\S]+?)\n»»»+\s*\n/, function (wholematch, format, content) {
parseMetadataContents(content);
return '¨M';
});
text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
text = text.replace(/^\s*---+\s*(\S*?)\n([\s\S]+?)\n---+\s*\n/, function (wholematch, format, content) {
if (format) {
globals.metadata.format = format;
}

View File

@ -0,0 +1,8 @@
<p><strong>some</strong> markdown text</p>
<ul>
<li>a list</li>
<li>another list ---</li>
<li>and stuff</li>
</ul>
<p>a paragraph --- with dashes</p>
<hr />

View File

@ -0,0 +1,16 @@
---
title: This is the document title
language: en
author: Tivie
---
**some** markdown text
- a list
- another list ---
- and stuff
a paragraph --- with dashes
---

View File

@ -100,6 +100,8 @@ describe('makeHtml() features testsuite', function () {
converter = new showdown.Converter({openLinksInNewWindow: true});
} else if (testsuite[i].name === '#355.simplifiedAutoLink-URLs-inside-parenthesis-followed-by-another-character-are-not-parsed-correctly') {
converter = new showdown.Converter({simplifiedAutoLink: true});
} else if (testsuite[i].name === '#709.allow-whitespaces-after-end-in-metadata') {
converter = new showdown.Converter({metadata: true});
} else if (testsuite[i].name === 'relativePathBaseUrl') {
converter = new showdown.Converter({relativePathBaseUrl: 'http://my.site.com/'});
} else {