@@ -85,6 +85,7 @@ import {parse} from 'micromark/lib/parse.js'
85
85
import { preprocess } from 'micromark/lib/preprocess.js'
86
86
import { postprocess } from 'micromark/lib/postprocess.js'
87
87
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference'
88
+ import { decodeString } from 'micromark-util-decode-string'
88
89
import { normalizeIdentifier } from 'micromark-util-normalize-identifier'
89
90
import { codes } from 'micromark-util-symbol/codes.js'
90
91
import { constants } from 'micromark-util-symbol/constants.js'
@@ -866,13 +867,14 @@ function compiler(options = {}) {
866
867
867
868
/** @type {Handle } */
868
869
function onexitlabeltext ( token ) {
869
- const ancestor = /** @type {(Link|Image) & {identifier: string} } */ (
870
- this . stack [ this . stack . length - 2 ]
871
- )
870
+ const ancestor =
871
+ /** @type {(Link|Image) & {identifier: string, label: string} } */ (
872
+ this . stack [ this . stack . length - 2 ]
873
+ )
874
+ const string = this . sliceSerialize ( token )
872
875
873
- ancestor . identifier = normalizeIdentifier (
874
- this . sliceSerialize ( token )
875
- ) . toLowerCase ( )
876
+ ancestor . label = decodeString ( string )
877
+ ancestor . identifier = normalizeIdentifier ( string ) . toLowerCase ( )
876
878
}
877
879
878
880
/** @type {Handle } */
@@ -884,8 +886,6 @@ function compiler(options = {}) {
884
886
this . stack [ this . stack . length - 1 ]
885
887
)
886
888
887
- node . label = node . identifier
888
-
889
889
// Assume a reference.
890
890
setData ( 'inReference' , true )
891
891
0 commit comments