修复@符号导致的Markdown链接解析异常

This commit is contained in:
zmister 2021-12-11 09:34:28 +08:00
parent 506ec6eb1b
commit d732871739

View File

@ -3758,28 +3758,28 @@
// marked @ 解析
markedRenderer.atLink = function(text) {
if (atLinkReg.test(text))
{
if (settings.atLink)
{
text = text.replace(emailReg, function($1, $2, $3, $4) {
return $1.replace(/@/g, "_#_@_#_");
});
// if (atLinkReg.test(text))
// {
// if (settings.atLink)
// {
// text = text.replace(emailReg, function($1, $2, $3, $4) {
// return $1.replace(/@/g, "_#_@_#_");
// });
text = text.replace(atLinkReg, function($1, $2) {
return "<a href=\"" + editormd.urls.atLinkBase + "" + $2 + "\" title=\"&#64;" + $2 + "\" class=\"at-link\">" + $1 + "</a>";
}).replace(/_#_&#64;_#_/g, "@");
}
if (settings.emailLink)
{
text = text.replace(emailLinkReg, function($1, $2, $3, $4, $5) {
return (!$2 && $.inArray($5, "jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|")) < 0) ? "<a href=\"mailto:" + $1 + "\">"+$1+"</a>" : $1;
});
}
// text = text.replace(atLinkReg, function($1, $2) {
// return "<a href=\"" + editormd.urls.atLinkBase + "" + $2 + "\" title=\"&#64;" + $2 + "\" class=\"at-link\">" + $1 + "</a>";
// }).replace(/_#_&#64;_#_/g, "@");
// }
return text;
}
// if (settings.emailLink)
// {
// text = text.replace(emailLinkReg, function($1, $2, $3, $4, $5) {
// return (!$2 && $.inArray($5, "jpg|jpeg|png|gif|webp|ico|icon|pdf".split("|")) < 0) ? "<a href=\"mailto:" + $1 + "\">"+$1+"</a>" : $1;
// });
// }
// return text;
// }
return text;
};