update hyperdown

This commit is contained in:
joyqi 2021-07-20 16:12:32 +08:00
parent 454302b3a1
commit 3dd592ae59
2 changed files with 4 additions and 4 deletions

View File

@ -412,7 +412,7 @@
var link, matches, url;
matches = 1 <= arguments.length ? slice.call(arguments, 0) : [];
url = _this.cleanUrl(matches[2]);
link = _this.call('parseLink', url);
link = _this.call('parseLink', matches[2]);
return matches[1] + "<a href=\"" + url + "\">" + link + "</a>" + matches[5];
};
})(this));
@ -521,7 +521,6 @@
var matches, space, tab, type;
if ((this.isBlock('list')) && !line.match(/^\s*\[((?:[^\]]|\\\]|\\\[)+?)\]:\s*(.+)$/)) {
if (!!(line.match(/^(\s*)(~{3,}|`{3,})([^`~]*)$/i))) {
state.empty = 0;
return true;
} else if ((state.empty <= 1) && !!(matches = line.match(/^(\s*)\S+/)) && matches[1].length >= (block[3][0] + state.empty)) {
state.empty = 0;
@ -562,6 +561,7 @@
}
isAfterList = block[3][2];
if (isAfterList) {
state.empty = 0;
this.combineBlock().setBlock(key);
} else {
(this.setBlock(key)).endBlock();

View File

@ -544,7 +544,7 @@ class HyperDown
"/(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,})($|[^\"])/",
function ($matches) use ($self) {
$url = $self->cleanUrl($matches[2]);
$link = $self->call('parseLink', $url);
$link = $self->call('parseLink', $matches[2]);
return "{$matches[1]}<a href=\"{$url}\">{$link}</a>{$matches[5]}";
},
$text
@ -699,7 +699,6 @@ class HyperDown
if ($this->isBlock('list') && !preg_match("/^\s*\[((?:[^\]]|\\]|\\[)+?)\]:\s*(.+)$/", $line)) {
if (preg_match("/^(\s*)(~{3,}|`{3,})([^`~]*)$/i", $line)) {
// ignore code
$state['empty'] = 0;
return true;
} elseif ($state['empty'] <= 1
&& preg_match("/^(\s*)\S+/", $line, $matches)
@ -757,6 +756,7 @@ class HyperDown
$isAfterList = $block[3][2];
if ($isAfterList) {
$state['empty'] = 0;
$this->combineBlock()
->setBlock($key);
} else {