@@ -570,7 +570,7 @@ InlineLexer.prototype.output = function (src) {
570
570
href = text
571
571
}
572
572
573
- out . push ( React . createElement ( "a" , { href : this . sanitizeUrl ( href ) , key :href } , text ) )
573
+ out . push ( React . createElement ( "a" , { href : this . sanitizeUrl ( href ) , key :href } , text ) )
574
574
continue
575
575
}
576
576
@@ -579,7 +579,7 @@ InlineLexer.prototype.output = function (src) {
579
579
src = src . substring ( cap [ 0 ] . length )
580
580
text = cap [ 1 ]
581
581
href = text
582
- out . push ( React . createElement ( "a" , { href : this . sanitizeUrl ( href ) , key :href } , text ) )
582
+ out . push ( React . createElement ( "a" , { href : this . sanitizeUrl ( href ) , key :href } , text ) )
583
583
continue
584
584
}
585
585
@@ -624,36 +624,48 @@ InlineLexer.prototype.output = function (src) {
624
624
if ( ( cap = this . rules . strong . exec ( src ) ) ) {
625
625
src = src . substring ( cap [ 0 ] . length )
626
626
out . push (
627
- React . createElement ( "strong" , null , this . output ( cap [ 2 ] || cap [ 1 ] ) )
627
+ React . createElement (
628
+ "strong" ,
629
+ { key : src . length } ,
630
+ this . output ( cap [ 2 ] || cap [ 1 ] )
631
+ )
628
632
)
629
633
continue
630
634
}
631
635
632
636
// em
633
637
if ( ( cap = this . rules . em . exec ( src ) ) ) {
634
638
src = src . substring ( cap [ 0 ] . length )
635
- out . push ( React . createElement ( "em" , null , this . output ( cap [ 2 ] || cap [ 1 ] ) ) )
639
+ out . push (
640
+ React . createElement (
641
+ "em" ,
642
+ { key : src . length } ,
643
+ this . output ( cap [ 2 ] || cap [ 1 ] )
644
+ )
645
+ )
636
646
continue
637
647
}
638
648
639
649
// code
640
650
if ( ( cap = this . rules . code . exec ( src ) ) ) {
641
651
src = src . substring ( cap [ 0 ] . length )
642
- out . push ( React . createElement ( "code" , null , cap [ 2 ] ) )
652
+ out . push ( React . createElement ( "code" , { key : src . length } , cap [ 2 ] ) )
643
653
continue
644
654
}
645
655
646
656
// br
647
657
if ( ( cap = this . rules . br . exec ( src ) ) ) {
648
658
src = src . substring ( cap [ 0 ] . length )
649
- out . push ( React . createElement ( "br" , null , null ) )
659
+ out . push ( React . createElement ( "br" , { key : src . length } , null ) )
650
660
continue
651
661
}
652
662
653
663
// del (gfm)
654
664
if ( ( cap = this . rules . del . exec ( src ) ) ) {
655
665
src = src . substring ( cap [ 0 ] . length )
656
- out . push ( React . createElement ( "del" , null , this . output ( cap [ 1 ] ) ) )
666
+ out . push (
667
+ React . createElement ( "del" , { key : src . length } , this . output ( cap [ 1 ] ) )
668
+ )
657
669
continue
658
670
}
659
671
@@ -708,6 +720,7 @@ InlineLexer.prototype.outputLink = function (cap, link) {
708
720
title : link . title ,
709
721
target : shouldOpenInNewWindow ? "_blank" : null ,
710
722
rel : shouldOpenInNewWindow ? "nofollow noopener noreferrer" : null ,
723
+ key : link . href ,
711
724
} ,
712
725
this . output ( cap [ 1 ] )
713
726
)
@@ -718,6 +731,7 @@ InlineLexer.prototype.outputLink = function (cap, link) {
718
731
src : this . sanitizeUrl ( link . href ) ,
719
732
alt : cap [ 1 ] ,
720
733
title : link . title ,
734
+ key : link . href ,
721
735
} ,
722
736
null
723
737
)
@@ -813,7 +827,7 @@ Parser.prototype.tok = function () {
813
827
return [ ]
814
828
}
815
829
case "hr" : {
816
- return React . createElement ( "hr" , null , null )
830
+ return React . createElement ( "hr" , { key : this . tokens . length } , null )
817
831
}
818
832
case "heading" : {
819
833
return (
@@ -822,6 +836,7 @@ Parser.prototype.tok = function () {
822
836
level = { this . token . depth }
823
837
toSlug = { this . token . text }
824
838
usedSlugs = { this . usedSlugs }
839
+ key = { this . tokens . length }
825
840
>
826
841
{ this . inline . output ( this . token . text ) }
827
842
</ Header >
@@ -853,13 +868,20 @@ Parser.prototype.tok = function () {
853
868
schema = { schema }
854
869
query = { query }
855
870
variables = { variables }
871
+ key = { this . tokens . length }
856
872
/>
857
873
)
858
874
}
859
875
}
860
876
}
861
877
862
- return < Prism language = { this . token . lang } code = { this . token . text } />
878
+ return (
879
+ < Prism
880
+ language = { this . token . lang }
881
+ code = { this . token . text }
882
+ key = { this . tokens . length }
883
+ />
884
+ )
863
885
}
864
886
case "table" : {
865
887
var table = [ ] ,
@@ -884,7 +906,7 @@ Parser.prototype.tok = function () {
884
906
)
885
907
}
886
908
table . push (
887
- React . createElement ( "thead" , null , React . createElement ( "tr" , null , row ) )
909
+ React . createElement ( "thead" , { key : this . tokens . length } , React . createElement ( "tr" , null , row ) )
888
910
)
889
911
890
912
// body
@@ -915,7 +937,11 @@ Parser.prototype.tok = function () {
915
937
body . push ( this . tok ( ) )
916
938
}
917
939
918
- return React . createElement ( "blockquote" , null , body )
940
+ return React . createElement (
941
+ "blockquote" ,
942
+ { key : this . tokens . length } ,
943
+ body
944
+ )
919
945
}
920
946
case "list_start" : {
921
947
var type = this . token . ordered ? "ol" : "ul" ,
@@ -925,7 +951,7 @@ Parser.prototype.tok = function () {
925
951
body . push ( this . tok ( ) )
926
952
}
927
953
928
- return React . createElement ( type , null , body )
954
+ return React . createElement ( type , { key : this . tokens . length } , body )
929
955
}
930
956
case "list_item_start" : {
931
957
var body = [ ]
@@ -934,7 +960,7 @@ Parser.prototype.tok = function () {
934
960
body . push ( this . token . type === "text" ? this . parseText ( ) : this . tok ( ) )
935
961
}
936
962
937
- return React . createElement ( "li" , null , body )
963
+ return React . createElement ( "li" , { key : this . tokens . length } , body )
938
964
}
939
965
case "loose_item_start" : {
940
966
var body = [ ]
@@ -943,13 +969,14 @@ Parser.prototype.tok = function () {
943
969
body . push ( this . tok ( ) )
944
970
}
945
971
946
- return React . createElement ( "li" , null , body )
972
+ return React . createElement ( "li" , { key : this . tokens . length } , body )
947
973
}
948
974
case "html" : {
949
975
return React . createElement ( "div" , {
950
976
dangerouslySetInnerHTML : {
951
977
__html : this . token . text ,
952
978
} ,
979
+ key : this . tokens . length ,
953
980
} )
954
981
}
955
982
case "paragraph" : {
@@ -958,12 +985,20 @@ Parser.prototype.tok = function () {
958
985
null ,
959
986
this . inline . output ( this . token . text )
960
987
)
961
- : React . createElement ( "p" , null , this . inline . output ( this . token . text ) )
988
+ : React . createElement (
989
+ "p" ,
990
+ { key : this . tokens . length } ,
991
+ this . inline . output ( this . token . text )
992
+ )
962
993
}
963
994
case "text" : {
964
995
return this . options . paragraphFn
965
996
? this . options . paragraphFn . call ( null , this . parseText ( ) )
966
- : React . createElement ( "p" , null , this . parseText ( ) )
997
+ : React . createElement (
998
+ "p" ,
999
+ { key : this . tokens . length } ,
1000
+ this . parseText ( )
1001
+ )
967
1002
}
968
1003
}
969
1004
}
0 commit comments