@@ -274,14 +274,14 @@ var Parser = (function () {
274
274
} ) ;
275
275
276
276
// image
277
- var imagePattern1 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / ;
277
+ var imagePattern1 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / g ;
278
278
text = text . replace ( imagePattern1 , function ( match , p1 , p2 ) {
279
279
var escaped = _this . escapeBracket ( p1 ) ;
280
280
var url = _this . escapeBracket ( p2 ) ;
281
281
return _this . makeHolder ( '<img src="' + url + '" alt="' + escaped + '" title="' + escaped + '">' ) ;
282
282
} ) ;
283
283
284
- var imagePattern2 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / ;
284
+ var imagePattern2 = / ! \[ ( (?: [ ^ \] ] | \] | \[ ) * ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / g ;
285
285
text = text . replace ( imagePattern2 , function ( match , p1 , p2 ) {
286
286
var escaped = _this . escapeBracket ( p1 ) ;
287
287
var result = '' ;
@@ -294,14 +294,14 @@ var Parser = (function () {
294
294
} ) ;
295
295
296
296
// link
297
- var linkPattern1 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / ;
297
+ var linkPattern1 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \( ( (?: [ ^ \) ] | \) | \( ) + ?) \) / g ;
298
298
text = text . replace ( linkPattern1 , function ( match , p1 , p2 ) {
299
299
var escaped = _this . parseInline ( _this . escapeBracket ( p1 ) , '' , false ) ;
300
300
var url = _this . escapeBracket ( p2 ) ;
301
301
return _this . makeHolder ( '<a href="' + url + '">' + escaped + '</a>' ) ;
302
302
} ) ;
303
303
304
- var linkPattern2 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / ;
304
+ var linkPattern2 = / \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] \[ ( (?: [ ^ \] ] | \] | \[ ) + ?) \] / g ;
305
305
text = text . replace ( linkPattern2 , function ( match , p1 , p2 ) {
306
306
var escaped = _this . parseInline ( _this . escapeBracket ( p1 ) , '' , false ) ;
307
307
@@ -316,13 +316,6 @@ var Parser = (function () {
316
316
} ) ;
317
317
318
318
// 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>")
326
319
text = this . parseInlineCallback ( text ) ;
327
320
text = text . replace ( / < ( [ _ a - z 0 - 9 -\. \+ ] + @ [ ^ @ ] + \. [ a - z ] { 2 , } ) > / ig, "<a href=\"mailto:$1\">$1</a>" ) ;
328
321
@@ -1259,4 +1252,7 @@ var Parser = (function () {
1259
1252
} ) ( ) ;
1260
1253
1261
1254
exports [ '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)' ) ) ;
1262
1258
module . exports = exports [ 'default' ] ;
0 commit comments