@@ -274,14 +274,14 @@ var Parser = (function () {
274274 } ) ;
275275
276276 // image
277- var imagePattern1 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / ;
277+ var imagePattern1 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / g ;
278278 text = text . replace ( imagePattern1 , function ( match , p1 , p2 ) {
279279 var escaped = _this . escapeBracket ( p1 ) ;
280280 var url = _this . escapeBracket ( p2 ) ;
281281 return _this . makeHolder ( '<img src="' + url + '" alt="' + escaped + '" title="' + escaped + '">' ) ;
282282 } ) ;
283283
284- var imagePattern2 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / ;
284+ var imagePattern2 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / g ;
285285 text = text . replace ( imagePattern2 , function ( match , p1 , p2 ) {
286286 var escaped = _this . escapeBracket ( p1 ) ;
287287 var result = '' ;
@@ -294,14 +294,14 @@ var Parser = (function () {
294294 } ) ;
295295
296296 // link
297- var linkPattern1 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / ;
297+ var linkPattern1 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / g ;
298298 text = text . replace ( linkPattern1 , function ( match , p1 , p2 ) {
299299 var escaped = _this . parseInline ( _this . escapeBracket ( p1 ) , '' , false ) ;
300300 var url = _this . escapeBracket ( p2 ) ;
301301 return _this . makeHolder ( '<a href="' + url + '">' + escaped + '</a>' ) ;
302302 } ) ;
303303
304- var linkPattern2 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / ;
304+ var linkPattern2 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / g ;
305305 text = text . replace ( linkPattern2 , function ( match , p1 , p2 ) {
306306 var escaped = _this . parseInline ( _this . escapeBracket ( p1 ) , '' , false ) ;
307307
@@ -316,13 +316,6 @@ var Parser = (function () {
316316 } ) ;
317317
318318 // strong and em and some fuck
319- // text = text.replace(/(\*{3})(.+?)\1/g, "<strong><em>$2</em></strong>")
320- // text = text.replace(/(\*{2})(.+?)\1/g, "<strong>$2</strong>")
321- // text = text.replace(/(\*)(.+?)\1/g, "<em>$2</em>")
322- // text = text.replace(/(\s+)(_{3})(.+?)\2(\s+)/g, "$1<strong><em>$3</em></strong>$4")
323- // text = text.replace(/(\s+)(_{2})(.+?)\2(\s+)/g, "$1<strong>$3</strong>$4")
324- // text = text.replace(/(\s+)(_)(.+?)\2(\s+)/g, "$1<em>$3</em>$4")
325- // text = text.replace(/(~{2})(.+?)\1/g, "<del>$2</del>")
326319 text = this . parseInlineCallback ( text ) ;
327320 text = text . replace ( / < ( [ _ a - z 0 - 9 -\. \+ ] + @ [ ^ @ ] + \. [ a - z ] { 2 , } ) > / ig, "<a href=\"mailto:$1\">$1</a>" ) ;
328321
@@ -1259,4 +1252,7 @@ var Parser = (function () {
12591252} ) ( ) ;
12601253
12611254exports [ 'default' ] = Parser ;
1255+
1256+ var parser = new Parser ( ) ;
1257+ console . log ( parser . makeHtml ( '[Genymotion](https://www.genymotion.com/)是。[Genymotion](https://www.genymotion.com/) [VirtualBox](https://www.virtualbox.org/)富的[付费版](https://shop.genymotion.com/index.php?controller=order-opc)' ) ) ;
12621258module . exports = exports [ 'default' ] ;
0 commit comments