File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const range = str => str.split('-').map(c => `\\u${c}`).join('-');
2424
2525const CJK = cjk_ranges . map ( range ) . join ( '' ) ;
2626
27- const regex = new RegExp ( `([${ CJK } ])([ \\s\\n]+ )([${ CJK } ])` , 'gm' ) ;
27+ const regex = new RegExp ( `([${ CJK } ])(\\s* \\n+\\s* )([${ CJK } ])` , 'gm' ) ;
2828
2929function joinCKJLines ( tree ) {
3030 visit ( tree , 'text' , node => {
Original file line number Diff line number Diff line change @@ -30,7 +30,13 @@ describe('remark-join-cjk-lines', () => {
3030 expect ( output ) . toBe ( '汉字换,行' ) ;
3131 } ) ;
3232
33- it ( 'should keep the space between non-cjk charactors' , ( ) => {
33+ it ( 'should keep non-linebreak space between cjk characters' , ( ) => {
34+ const input = [ '汉字 换' , ' 行' ] . join ( '\n' ) ;
35+ const output = process ( input ) ;
36+ expect ( output ) . toBe ( '汉字 换行' ) ;
37+ } ) ;
38+
39+ it ( 'should keep the space between non-cjk characters' , ( ) => {
3440 const input = [ 'non-cjk' , '行' ] . join ( '\n' ) ;
3541 const output = process ( input ) ;
3642 expect ( output ) . toBe ( 'non-cjk\n行' ) ;
You can’t perform that action at this time.
0 commit comments