@@ -125,7 +125,6 @@ function compiler() {
125125 var characterReferenceType
126126 var expectingFirstListItemValue
127127 var atHardBreak
128- var inImage
129128 var inReference
130129 var referenceType
131130
@@ -319,7 +318,6 @@ function compiler() {
319318
320319 function enter ( token ) {
321320 var node = create ( token )
322-
323321 context . children . push ( node )
324322 context = node
325323 stack . push ( node )
@@ -399,8 +397,10 @@ function compiler() {
399397 context . value = data
400398 }
401399
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 )
404404 context . label = data
405405 context . identifier = normalizeIdentifier ( data ) . toLowerCase ( )
406406 }
@@ -503,7 +503,6 @@ function compiler() {
503503
504504 function onenterimage ( ) {
505505 buffer ( )
506- inImage = true
507506 }
508507
509508 function onexitlink ( ) {
@@ -551,10 +550,10 @@ function compiler() {
551550 // Assume a reference.
552551 inReference = true
553552
554- if ( inImage ) {
553+ // If we’re in a fragment, we’re in an image and buffering.
554+ if ( context . type === 'fragment' ) {
555555 data = resume ( )
556556 context . alt = data
557- inImage = undefined
558557 }
559558 }
560559
@@ -576,8 +575,9 @@ function compiler() {
576575 referenceType = 'collapsed'
577576 }
578577
579- function onexitreferencestring ( ) {
580- var data = resume ( )
578+ function onexitreferencestring ( token ) {
579+ resume ( )
580+ var data = this . sliceSerialize ( token )
581581 context . label = data
582582 context . identifier = normalizeIdentifier ( data ) . toLowerCase ( )
583583 referenceType = 'full'
@@ -659,11 +659,11 @@ function compiler() {
659659 }
660660
661661 function image ( ) {
662- return { type : 'image' , title : null , url : null , alt : null }
662+ return { type : 'image' , title : null , url : '' , alt : null }
663663 }
664664
665665 function link ( ) {
666- return { type : 'link' , title : null , url : null , children : [ ] }
666+ return { type : 'link' , title : null , url : '' , children : [ ] }
667667 }
668668
669669 function list ( token ) {
0 commit comments