@@ -694,43 +694,6 @@ InlineLexer.prototype.output = function(src) {
694694 continue ;
695695 }
696696
697- // autolink
698- if ( cap = this . rules . autolink . exec ( src ) ) {
699- src = src . substring ( cap [ 0 ] . length ) ;
700- if ( cap [ 2 ] === '@' ) {
701- text = escape ( this . mangle ( cap [ 1 ] ) ) ;
702- href = 'mailto:' + text ;
703- } else {
704- text = escape ( cap [ 1 ] ) ;
705- href = text ;
706- }
707- out += this . renderer . link ( href , null , text ) ;
708- continue ;
709- }
710-
711- // url (gfm)
712- if ( ! this . inLink && ( cap = this . rules . url . exec ( src ) ) ) {
713- if ( cap [ 2 ] === '@' ) {
714- text = escape ( cap [ 0 ] ) ;
715- href = 'mailto:' + text ;
716- } else {
717- // do extended autolink path validation
718- do {
719- prevCapZero = cap [ 0 ] ;
720- cap [ 0 ] = this . rules . _backpedal . exec ( cap [ 0 ] ) [ 0 ] ;
721- } while ( prevCapZero !== cap [ 0 ] ) ;
722- text = escape ( cap [ 0 ] ) ;
723- if ( cap [ 1 ] === 'www.' ) {
724- href = 'http://' + text ;
725- } else {
726- href = text ;
727- }
728- }
729- src = src . substring ( cap [ 0 ] . length ) ;
730- out += this . renderer . link ( href , null , text ) ;
731- continue ;
732- }
733-
734697 // tag
735698 if ( cap = this . rules . tag . exec ( src ) ) {
736699 if ( ! this . inLink && / ^ < a / i. test ( cap [ 0 ] ) ) {
@@ -831,6 +794,43 @@ InlineLexer.prototype.output = function(src) {
831794 continue ;
832795 }
833796
797+ // autolink
798+ if ( cap = this . rules . autolink . exec ( src ) ) {
799+ src = src . substring ( cap [ 0 ] . length ) ;
800+ if ( cap [ 2 ] === '@' ) {
801+ text = escape ( this . mangle ( cap [ 1 ] ) ) ;
802+ href = 'mailto:' + text ;
803+ } else {
804+ text = escape ( cap [ 1 ] ) ;
805+ href = text ;
806+ }
807+ out += this . renderer . link ( href , null , text ) ;
808+ continue ;
809+ }
810+
811+ // url (gfm)
812+ if ( ! this . inLink && ( cap = this . rules . url . exec ( src ) ) ) {
813+ if ( cap [ 2 ] === '@' ) {
814+ text = escape ( cap [ 0 ] ) ;
815+ href = 'mailto:' + text ;
816+ } else {
817+ // do extended autolink path validation
818+ do {
819+ prevCapZero = cap [ 0 ] ;
820+ cap [ 0 ] = this . rules . _backpedal . exec ( cap [ 0 ] ) [ 0 ] ;
821+ } while ( prevCapZero !== cap [ 0 ] ) ;
822+ text = escape ( cap [ 0 ] ) ;
823+ if ( cap [ 1 ] === 'www.' ) {
824+ href = 'http://' + text ;
825+ } else {
826+ href = text ;
827+ }
828+ }
829+ src = src . substring ( cap [ 0 ] . length ) ;
830+ out += this . renderer . link ( href , null , text ) ;
831+ continue ;
832+ }
833+
834834 // text
835835 if ( cap = this . rules . text . exec ( src ) ) {
836836 src = src . substring ( cap [ 0 ] . length ) ;
0 commit comments