@@ -125,7 +125,6 @@ function compiler() {
125
125
var characterReferenceType
126
126
var expectingFirstListItemValue
127
127
var atHardBreak
128
- var inImage
129
128
var inReference
130
129
var referenceType
131
130
@@ -319,7 +318,6 @@ function compiler() {
319
318
320
319
function enter ( token ) {
321
320
var node = create ( token )
322
-
323
321
context . children . push ( node )
324
322
context = node
325
323
stack . push ( node )
@@ -399,8 +397,10 @@ function compiler() {
399
397
context . value = data
400
398
}
401
399
402
- function onexitdefinitionlabelstring ( ) {
403
- var data = resume ( )
400
+ function onexitdefinitionlabelstring ( token ) {
401
+ // Discard label, use the source content instead.
402
+ resume ( )
403
+ var data = this . sliceSerialize ( token )
404
404
context . label = data
405
405
context . identifier = normalizeIdentifier ( data ) . toLowerCase ( )
406
406
}
@@ -503,7 +503,6 @@ function compiler() {
503
503
504
504
function onenterimage ( ) {
505
505
buffer ( )
506
- inImage = true
507
506
}
508
507
509
508
function onexitlink ( ) {
@@ -551,10 +550,10 @@ function compiler() {
551
550
// Assume a reference.
552
551
inReference = true
553
552
554
- if ( inImage ) {
553
+ // If we’re in a fragment, we’re in an image and buffering.
554
+ if ( context . type === 'fragment' ) {
555
555
data = resume ( )
556
556
context . alt = data
557
- inImage = undefined
558
557
}
559
558
}
560
559
@@ -576,8 +575,9 @@ function compiler() {
576
575
referenceType = 'collapsed'
577
576
}
578
577
579
- function onexitreferencestring ( ) {
580
- var data = resume ( )
578
+ function onexitreferencestring ( token ) {
579
+ resume ( )
580
+ var data = this . sliceSerialize ( token )
581
581
context . label = data
582
582
context . identifier = normalizeIdentifier ( data ) . toLowerCase ( )
583
583
referenceType = 'full'
@@ -659,11 +659,11 @@ function compiler() {
659
659
}
660
660
661
661
function image ( ) {
662
- return { type : 'image' , title : null , url : null , alt : null }
662
+ return { type : 'image' , title : null , url : '' , alt : null }
663
663
}
664
664
665
665
function link ( ) {
666
- return { type : 'link' , title : null , url : null , children : [ ] }
666
+ return { type : 'link' , title : null , url : '' , children : [ ] }
667
667
}
668
668
669
669
function list ( token ) {
0 commit comments