55 */ 
66
77; ( function ( )  { 
8- 'use strict' ; 
98
109/** 
1110 * Block-Level Grammar 
@@ -450,21 +449,21 @@ Lexer.prototype.token = function(src, top, bq) {
450449
451450var  inline  =  { 
452451  escape : / ^ \\ ( [ \\ ` * { } \[ \] ( ) # + \- . ! _ > ] ) / , 
453-   autolink : / ^ < ( [ ^   < > ] + ( @ | : \/ ) [ ^   < > ] + ) > / , 
452+   autolink : / ^ < ( [ ^   > ] + ( @ | : \/ ) [ ^   > ] + ) > / , 
454453  url : noop , 
455-   tag : / ^ < ! - - [ \s \S ] * ?- - > | ^ < \/ ? \w + (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ < ' " > ] ) * ?> / , 
454+   tag : / ^ < ! - - [ \s \S ] * ?- - > | ^ < \/ ? \w + (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ ' " > ] ) * ?> / , 
456455  link : / ^ ! ? \[ ( i n s i d e ) \] \( h r e f \) / , 
457456  reflink : / ^ ! ? \[ ( i n s i d e ) \] \s * \[ ( [ ^ \] ] * ) \] / , 
458457  nolink : / ^ ! ? \[ ( (?: \[ [ ^ \] ] * \] | [ ^ \[ \] ] ) * ) \] / , 
459458  strong : / ^ _ _ ( [ \s \S ] + ?) _ _ (? ! _ ) | ^ \* \* ( [ \s \S ] + ?) \* \* (? ! \* ) / , 
460459  em : / ^ \b _ ( (?: [ ^ _ ] | _ _ ) + ?) _ \b | ^ \* ( (?: \* \* | [ \s \S ] ) + ?) \* (? ! \* ) / , 
461-   code : / ^ ( ` + ) ( [ \s \S ] * ?[ ^ ` ] ) \1(? ! ` ) / , 
460+   code : / ^ ( ` + ) \s * ( [ \s \S ] * ?[ ^ ` ] ) \s * \1(? ! ` ) / , 
462461  br : / ^   { 2 , } \n (? ! \s * $ ) / , 
463462  del : noop , 
464463  text : / ^ [ \s \S ] + ?(? = [ \\ < ! \[ _ * ` ] |   { 2 , } \n | $ ) / 
465464} ; 
466465
467- inline . _inside  =  / (?: \[ [ ^ \] ] * \] | \\ [ \[ \] ] | [ ^ \[ \] ] | \] (? = [ ^ \[ ] * \] ) ) * / ; 
466+ inline . _inside  =  / (?: \[ [ ^ \] ] * \] | [ ^ \[ \] ] | \] (? = [ ^ \[ ] * \] ) ) * / ; 
468467inline . _href  =  / \s * < ? ( [ \s \S ] * ?) > ? (?: \s + [ ' " ] ( [ \s \S ] * ?) [ ' " ] ) ? \s * / ; 
469468
470469inline . link  =  replace ( inline . link ) 
@@ -579,11 +578,9 @@ InlineLexer.prototype.output = function(src) {
579578    if  ( cap  =  this . rules . autolink . exec ( src ) )  { 
580579      src  =  src . substring ( cap [ 0 ] . length ) ; 
581580      if  ( cap [ 2 ]  ===  '@' )  { 
582-         text  =  escape ( 
583-           cap [ 1 ] . charAt ( 6 )  ===  ':' 
581+         text  =  cap [ 1 ] . charAt ( 6 )  ===  ':' 
584582          ? this . mangle ( cap [ 1 ] . substring ( 7 ) ) 
585-           : this . mangle ( cap [ 1 ] ) 
586-         ) ; 
583+           : this . mangle ( cap [ 1 ] ) ; 
587584        href  =  this . mangle ( 'mailto:' )  +  text ; 
588585      }  else  { 
589586        text  =  escape ( cap [ 1 ] ) ; 
@@ -664,7 +661,7 @@ InlineLexer.prototype.output = function(src) {
664661    // code 
665662    if  ( cap  =  this . rules . code . exec ( src ) )  { 
666663      src  =  src . substring ( cap [ 0 ] . length ) ; 
667-       out  +=  this . renderer . codespan ( escape ( cap [ 2 ] . trim ( ) ,  true ) ) ; 
664+       out  +=  this . renderer . codespan ( escape ( cap [ 2 ] ,  true ) ) ; 
668665      continue ; 
669666    } 
670667
@@ -876,15 +873,12 @@ Renderer.prototype.link = function(href, title, text) {
876873        . replace ( / [ ^ \w : ] / g,  '' ) 
877874        . toLowerCase ( ) ; 
878875    }  catch  ( e )  { 
879-       return  text ; 
876+       return  '' ; 
880877    } 
881-     if  ( prot . indexOf ( 'javascript:' )  ===  0  ||  prot . indexOf ( 'vbscript:' )  ===  0   ||   prot . indexOf ( 'data:' )   ===   0 )  { 
882-       return  text ; 
878+     if  ( prot . indexOf ( 'javascript:' )  ===  0  ||  prot . indexOf ( 'vbscript:' )  ===  0 )  { 
879+       return  '' ; 
883880    } 
884881  } 
885-   if  ( this . options . baseUrl  &&  ! originIndependentUrl . test ( href ) )  { 
886-     href  =  resolveUrl ( this . options . baseUrl ,  href ) ; 
887-   } 
888882  var  out  =  '<a href="'  +  href  +  '"' ; 
889883  if  ( title )  { 
890884    out  +=  ' title="'  +  title  +  '"' ; 
@@ -894,9 +888,6 @@ Renderer.prototype.link = function(href, title, text) {
894888} ; 
895889
896890Renderer . prototype . image  =  function ( href ,  title ,  text )  { 
897-   if  ( this . options . baseUrl  &&  ! originIndependentUrl . test ( href ) )  { 
898-     href  =  resolveUrl ( this . options . baseUrl ,  href ) ; 
899-   } 
900891  var  out  =  '<img src="'  +  href  +  '" alt="'  +  text  +  '"' ; 
901892  if  ( title )  { 
902893    out  +=  ' title="'  +  title  +  '"' ; 
@@ -1103,8 +1094,8 @@ function escape(html, encode) {
11031094} 
11041095
11051096function  unescape ( html )  { 
1106- 	// explicitly match decimal, hex, and named HTML entities 
1107-   return  html . replace ( / & ( # (?: \d + ) | (?: # x [ 0 - 9 A - F a - f ] + ) | (?: \w + ) ) ; ? / ig ,  function ( _ ,  n )  { 
1097+ 	// explicitly match decimal, hex, and named HTML entities   
1098+   return  html . replace ( / & ( # (?: \d + ) | (?: # x [ 0 - 9 A - F a - f ] + ) | (?: \w + ) ) ; ? / g ,  function ( _ ,  n )  { 
11081099    n  =  n . toLowerCase ( ) ; 
11091100    if  ( n  ===  'colon' )  return  ':' ; 
11101101    if  ( n . charAt ( 0 )  ===  '#' )  { 
@@ -1128,30 +1119,6 @@ function replace(regex, opt) {
11281119  } ; 
11291120} 
11301121
1131- function  resolveUrl ( base ,  href )  { 
1132-   if  ( ! baseUrls [ ' '  +  base ] )  { 
1133-     // we can ignore everything in base after the last slash of its path component, 
1134-     // but we might need to add _that_ 
1135-     // https://tools.ietf.org/html/rfc3986#section-3 
1136-     if  ( / ^ [ ^ : ] + : \/ * [ ^ / ] * $ / . test ( base ) )  { 
1137-       baseUrls [ ' '  +  base ]  =  base  +  '/' ; 
1138-     }  else  { 
1139-       baseUrls [ ' '  +  base ]  =  base . replace ( / [ ^ / ] * $ / ,  '' ) ; 
1140-     } 
1141-   } 
1142-   base  =  baseUrls [ ' '  +  base ] ; 
1143- 
1144-   if  ( href . slice ( 0 ,  2 )  ===  '//' )  { 
1145-     return  base . replace ( / : [ \s \S ] * / ,  ':' )  +  href ; 
1146-   }  else  if  ( href . charAt ( 0 )  ===  '/' )  { 
1147-     return  base . replace ( / ( : \/ * [ ^ / ] * ) [ \s \S ] * / ,  '$1' )  +  href ; 
1148-   }  else  { 
1149-     return  base  +  href ; 
1150-   } 
1151- } 
1152- var  baseUrls  =  { } ; 
1153- var  originIndependentUrl  =  / ^ $ | ^ [ a - z ] [ a - z 0 - 9 + . - ] * : | ^ [ ? # ] / i; 
1154- 
11551122function  noop ( )  { } 
11561123noop . exec  =  noop ; 
11571124
@@ -1253,7 +1220,7 @@ function marked(src, opt, callback) {
12531220  }  catch  ( e )  { 
12541221    e . message  +=  '\nPlease report this to https://github.com/chjj/marked.' ; 
12551222    if  ( ( opt  ||  marked . defaults ) . silent )  { 
1256-       return  '<p>An error occurred :</p><pre>' 
1223+       return  '<p>An error occured :</p><pre>' 
12571224        +  escape ( e . message  +  '' ,  true ) 
12581225        +  '</pre>' ; 
12591226    } 
@@ -1286,8 +1253,7 @@ marked.defaults = {
12861253  smartypants : false , 
12871254  headerPrefix : '' , 
12881255  renderer : new  Renderer , 
1289-   xhtml : false , 
1290-   baseUrl : null 
1256+   xhtml : false 
12911257} ; 
12921258
12931259/** 
0 commit comments