File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ export function footer(state) {
21
21
let index = - 1
22
22
23
23
while ( ++ index < state . footnoteOrder . length ) {
24
- const def = state . footnoteById [ state . footnoteOrder [ index ] . toUpperCase ( ) ]
24
+ const def = state . footnoteById [ state . footnoteOrder [ index ] ]
25
25
26
26
if ( ! def ) {
27
27
continue
28
28
}
29
29
30
30
const content = state . all ( def )
31
- const id = String ( def . identifier )
31
+ const id = String ( def . identifier ) . toUpperCase ( )
32
32
const safeId = normalizeUri ( id . toLowerCase ( ) )
33
33
let referenceIndex = 0
34
34
/** @type {Array<ElementContent> } */
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import {normalizeUri} from 'micromark-util-sanitize-uri'
17
17
* hast node.
18
18
*/
19
19
export function footnoteReference ( state , node ) {
20
- const id = String ( node . identifier )
20
+ const id = String ( node . identifier ) . toUpperCase ( )
21
21
const safeId = normalizeUri ( id . toLowerCase ( ) )
22
22
const index = state . footnoteOrder . indexOf ( id )
23
23
/** @type {number } */
Original file line number Diff line number Diff line change @@ -278,4 +278,30 @@ test('footnote', () => {
278
278
</section>` ,
279
279
'should support a `footnoteLabelProperties`'
280
280
)
281
+
282
+ tree = toHast (
283
+ fromMarkdown (
284
+ 'a[^__proto__] b[^__proto__] c[^constructor]\n\n[^__proto__]: d\n[^constructor]: e' ,
285
+ {
286
+ extensions : [ gfm ( ) ] ,
287
+ mdastExtensions : [ gfmFromMarkdown ( ) ]
288
+ }
289
+ )
290
+ )
291
+ assert ( tree , 'expected node' )
292
+ assert . equal (
293
+ toHtml ( tree ) ,
294
+ `<p>a<sup><a href="#user-content-fn-__proto__" id="user-content-fnref-__proto__" data-footnote-ref aria-describedby="footnote-label">1</a></sup> b<sup><a href="#user-content-fn-__proto__" id="user-content-fnref-__proto__-2" data-footnote-ref aria-describedby="footnote-label">1</a></sup> c<sup><a href="#user-content-fn-constructor" id="user-content-fnref-constructor" data-footnote-ref aria-describedby="footnote-label">2</a></sup></p>
295
+ <section data-footnotes class="footnotes"><h2 class="sr-only" id="footnote-label">Footnotes</h2>
296
+ <ol>
297
+ <li id="user-content-fn-__proto__">
298
+ <p>d <a href="#user-content-fnref-__proto__" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a> <a href="#user-content-fnref-__proto__-2" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩<sup>2</sup></a></p>
299
+ </li>
300
+ <li id="user-content-fn-constructor">
301
+ <p>e <a href="#user-content-fnref-constructor" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
302
+ </li>
303
+ </ol>
304
+ </section>` ,
305
+ 'should support funky footnote identifiers'
306
+ )
281
307
} )
You can’t perform that action at this time.
0 commit comments