@@ -199,27 +199,61 @@ type RuleOptions = {
199
199
200
200
/* PUNCTUATIONS */
201
201
202
- // Convert these punctuations into half-width .
202
+ // Convert these punctuations into halfwidth .
203
203
// default preset: `()`
204
204
// e.g. `(文字)` -> `(文字)`
205
- halfWidthPunctuation ? : string
205
+ halfwidthPunctuation ? : string
206
206
207
- // Convert these punctuations into full-width .
207
+ // Convert these punctuations into fullwidth .
208
208
// default preset: `,。:;?!“”‘’`
209
209
// e.g. `文字,文字.` -> `文字,文字。`
210
- fullWidthPunctuation ? : string
210
+ fullwidthPunctuation ? : string
211
211
212
- // Treat these full-width punctuations as half-fullWidthPunctuation
212
+ // Treat these fullwidth punctuations as half-fullWidthPunctuation
213
213
// when processing the spaces issues around them.
214
214
// Since something like quotations in morder Chinese fonts are
215
- // only rendered in half-width .
215
+ // only rendered in halfwidth .
216
216
// default preset: `“”‘’`
217
- adjustedFullWidthPunctuation ? : string
217
+ adjustedFullwidthPunctuation ? : string
218
218
219
219
// Convert traditional Chinese punctuations into simplified ones or vice versa.
220
220
// default preset: `simplified`
221
221
// e.g. `「文字」` -> `“文字”`
222
- unifiedPunctuation? : ' traditional' | ' simplified'
222
+ //
223
+ // besides the above, we also unify some common punctuations below:
224
+ //
225
+ // // U+2047 DOUBLE QUESTION MARK, U+203C DOUBLE EXCLAMATION MARK
226
+ // // U+2048 QUESTION EXCLAMATION MARK, U+2049 EXCLAMATION QUESTION MARK
227
+ // '??': ['⁇'],
228
+ // '!!': ['‼'],
229
+ // '?!': ['⁈'],
230
+ // '!?': ['⁉'],
231
+ //
232
+ // // U+002F SOLIDUS, U+FF0F FULLWIDTH SOLIDUS
233
+ // '/': ['/', '/'],
234
+ //
235
+ // // U+FF5E FULLWIDTH TILDE
236
+ // '~': ['~', '~'],
237
+ //
238
+ // // U+2026 HORIZONTAL ELLIPSIS, U+22EF MIDLINE HORIZONTAL ELLIPSIS
239
+ // '…': ['…', '⋯'],
240
+ //
241
+ // // U+25CF BLACK CIRCLE, U+2022 BULLET, U+00B7 MIDDLE DOT,
242
+ // // U+2027 HYPHENATION POINT, U+30FB KATAKANA MIDDLE DOT
243
+ // '·': ['●', '•', '·', '‧', '・'],
244
+ //
245
+ // advanced usage: you can also specify a more detailed map like:
246
+ //
247
+ // ```
248
+ // {
249
+ // default: true, // follow all the default preset
250
+ // '「': ['“', '【'], // convert `“` or `【` into `「`
251
+ // '」': ['”', '】'], // convert `”` or `】` into `」`
252
+ // '…': true, // follow the default preset for this character
253
+ // '·': false, // not unify any of these characters
254
+ // }
255
+ // ```
256
+ unifiedPunctuation? : ' traditional' | ' simplified' | Record <string , boolean | string []> & { default: boolean }
223
257
224
258
// Special case: skip `fullWidthPunctuation` for abbreviations.
225
259
// default preset:
@@ -232,21 +266,21 @@ type RuleOptions = {
232
266
// - `true`: one space
233
267
// - `undefined`: do nothing
234
268
// e.g. `foo bar` -> `foo bar`
235
- spaceBetweenHalfWidthLetters ? : boolean
269
+ spaceBetweenHalfwidthContent ? : boolean
236
270
237
271
// default preset: `true`
238
272
// - `true`: zero space
239
273
// - `undefined`: do nothing
240
274
// e.g. `文 字` -> `文字`
241
- noSpaceBetweenFullWidthLetters ? : boolean
275
+ noSpaceBetweenFullwidthContent ? : boolean
242
276
243
277
// default preset: `true`
244
278
// - `true`: one space
245
279
// - `false`: zero space
246
280
// - `undefined`: do nothing
247
281
// e.g. `文字 foo文字` -> `文字 foo 文字` (`true`)
248
282
// e.g. `文字foo 文字` -> `文字foo文字` (`false`)
249
- spaceBetweenMixedWidthLetters ? : boolean
283
+ spaceBetweenMixedwidthContent ? : boolean
250
284
251
285
// Special case: skip `spaceBetweenMixedWidthContent`
252
286
// for numbers x Chinese units.
@@ -259,21 +293,21 @@ type RuleOptions = {
259
293
// - `true`: zero space
260
294
// - `undefined`: do nothing
261
295
// e.g. `文字 ,文字` -> `文字,文字`
262
- noSpaceBeforePunctuation ? : boolean
296
+ noSpaceBeforePauseOrStop ? : boolean
263
297
264
298
// default preset: `true`
265
299
// - `true`: one space
266
300
// - `false`: zero space
267
301
// - `undefined`: do nothing
268
302
// e.g. `文字,文字` -> `文字, 文字` (`true`)
269
303
// e.g. `文字, 文字` -> `文字,文字` (`false`)
270
- spaceAfterHalfWidthPunctuation ? : boolean
304
+ spaceAfterHalfwidthPauseOrStop ? : boolean
271
305
272
306
// default preset: `true`
273
307
// - `true`: zero space
274
308
// - `undefined`: do nothing
275
309
// e.g. `文字, 文字` -> `文字,文字`
276
- noSpaceAfterFullWidthPunctuation ? : boolean
310
+ noSpaceAfterFullwidthPauseOrStop ? : boolean
277
311
278
312
/* SPACES AROUND QUOTES */
279
313
@@ -283,32 +317,32 @@ type RuleOptions = {
283
317
// - `undefined`: do nothing
284
318
// e.g. `文字 "文字"文字` -> `文字 "文字" 文字` (`true`)
285
319
// e.g. `文字"文字" 文字` -> `文字"文字"文字` (`false`)
286
- spaceOutsideHalfQuote ? : boolean
320
+ spaceOutsideHalfwidthQuotation ? : boolean
287
321
288
322
// default preset: `true`
289
323
// - `true`: zero space
290
324
// - `undefined`: do nothing
291
325
// e.g. `文字 “文字” 文字` -> `文字“文字”文字`
292
- noSpaceOutsideFullQuote ? : boolean
326
+ noSpaceOutsideFullwidthQuotation ? : boolean
293
327
294
328
// default preset: `true`
295
329
// - `true`: zero space
296
330
// - `undefined`: do nothing
297
331
// e.g. `文字“ 文字 ”文字` -> `文字“文字”文字`
298
- noSpaceInsideQuote ? : boolean
332
+ noSpaceInsideQuotation ? : boolean
299
333
300
334
/* SPACES AROUND BRACKETS */
301
335
302
336
// default preset: `true`
303
337
// - `true`: one space
304
338
// - `false`: zero space
305
339
// - `undefined`: do nothing
306
- spaceOutsideHalfBracket ? : boolean
340
+ spaceOutsideHalfwidthBracket ? : boolean
307
341
308
342
// default preset: `true`
309
343
// - `true`: zero space
310
344
// - `undefined`: do nothing
311
- noSpaceOutsideFullBracket ? : boolean
345
+ noSpaceOutsideFullwidthBracket ? : boolean
312
346
313
347
// default preset: `true`
314
348
// - `true`: zero space
@@ -331,7 +365,7 @@ type RuleOptions = {
331
365
// - `true`: zero space
332
366
// - `undefined`: do nothing
333
367
// e.g. `文字** foo **文字` -> `文字 **foo** 文字`
334
- noSpaceInsideWrapper ? : boolean
368
+ noSpaceInsideHyperMark ? : boolean
335
369
336
370
/* SPACES AT THE BEGINNING/END */
337
371
@@ -340,4 +374,3 @@ type RuleOptions = {
340
374
trimSpace? : boolean
341
375
}
342
376
` ` `
343
-
0 commit comments