@@ -17,10 +17,10 @@ const defaultInline = (type, node, key, h) => {
17
17
} ;
18
18
19
19
const defaultMarkRenderers = {
20
- [ MARKS . BOLD ] : ( text , key , h ) => h ( 'strong' , { key } , text ) ,
21
- [ MARKS . ITALIC ] : ( text , key , h ) => h ( 'em' , { key } , text ) ,
22
- [ MARKS . UNDERLINE ] : ( text , key , h ) => h ( 'u' , { key } , text ) ,
23
- [ MARKS . CODE ] : ( text , key , h ) => h ( 'code' , { key } , text )
20
+ [ MARKS . BOLD ] : ( children , key , h ) => h ( 'strong' , { key } , children ) ,
21
+ [ MARKS . ITALIC ] : ( children , key , h ) => h ( 'em' , { key } , children ) ,
22
+ [ MARKS . UNDERLINE ] : ( children , key , h ) => h ( 'u' , { key } , children ) ,
23
+ [ MARKS . CODE ] : ( children , key , h ) => h ( 'code' , { key } , children )
24
24
} ;
25
25
26
26
const defaultNodeRenderers = {
@@ -80,13 +80,14 @@ const defaultNodeRenderers = {
80
80
)
81
81
} ,
82
82
text : ( { marks, value } , key , h , markRenderer ) => {
83
- return marks . length
84
- ? marks . reduce (
85
- ( aggregate , mark , i ) =>
86
- markRenderer [ mark . type ] ( aggregate , `${ key } -${ i } ` , h ) ,
87
- value
88
- )
89
- : value ;
83
+ if ( ! marks . length ) {
84
+ return value ;
85
+ }
86
+
87
+ const marksReversed = [ ...marks ] . reverse ( ) ;
88
+ return marksReversed . reduce ( ( aggregate , mark , i ) => (
89
+ markRenderer [ mark . type ] ( [ aggregate ] , `${ key } -${ i } ` , h )
90
+ ) , value )
90
91
}
91
92
} ;
92
93
0 commit comments