File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,9 @@ impl<'a> State<'a> {
242
242
results. push ( ' ' ) ;
243
243
new_info. before = " " ;
244
244
} else {
245
- new_info. before = & results[ results. len ( ) - 1 ..] ;
245
+ if let Some ( last_char) = results. chars ( ) . last ( ) {
246
+ new_info. before = & results[ results. len ( ) - last_char. len_utf8 ( ) ..] ;
247
+ }
246
248
}
247
249
}
248
250
Original file line number Diff line number Diff line change @@ -398,6 +398,15 @@ a _\\__ is this emphasis? _\\__"
398
398
. unwrap ( ) )
399
399
. unwrap ( ) ;
400
400
assert_eq ! ( to( & from( & doc, & Default :: default ( ) ) . unwrap( ) ) . unwrap( ) , doc) ;
401
+
402
+ let doc = "𝄞[some](another)" ;
403
+ let tree = markdown:: to_mdast ( & doc, & markdown:: ParseOptions :: default ( ) ) . unwrap ( ) ;
404
+
405
+ assert_eq ! (
406
+ to( & tree) . unwrap( ) ,
407
+ "𝄞[some](another)\n " ,
408
+ "should support utf8 in boundries when serializing"
409
+ ) ;
401
410
}
402
411
403
412
fn remove_pos ( node : & mut Node ) {
You can’t perform that action at this time.
0 commit comments