File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,13 @@ const visit = require('unist-util-visit')
2
2
const chinesePunctuationReg = / ( [ \u3002 \uff1b \uff0c \uff1a \u201c \u201d \uff08 \uff09 \u3001 \uff1f \u300a \u300b ] ) \n / g
3
3
4
4
module . exports = ( ) => {
5
- const visitor = ( node ) => {
6
- visit ( node , 'text' , textNode => {
7
- if ( chinesePunctuationReg . test ( textNode . value ) ) {
8
- textNode . value = textNode . value . replace ( chinesePunctuationReg , '$1' )
9
- }
10
- } )
5
+ const visitor = ( textNode ) => {
6
+ if ( chinesePunctuationReg . test ( textNode . value ) ) {
7
+ textNode . value = textNode . value . replace ( chinesePunctuationReg , '$1' )
8
+ }
11
9
}
12
10
13
11
return tree => {
14
- visit ( tree , 'element ' , visitor )
12
+ visit ( tree , 'text ' , visitor )
15
13
}
16
14
}
Original file line number Diff line number Diff line change 29
29
"dependencies" : {
30
30
"unist-util-visit" : " ^2.0.2"
31
31
}
32
- }
32
+ }
You can’t perform that action at this time.
0 commit comments