Skip to content

Commit acfd845

Browse files
committed
docs: update options
1 parent 3b842f8 commit acfd845

File tree

3 files changed

+162
-61
lines changed

3 files changed

+162
-61
lines changed

README.md

+54-20
Original file line numberDiff line numberDiff line change
@@ -287,27 +287,61 @@ type RuleOptions = {
287287

288288
/* PUNCTUATIONS */
289289

290-
// Convert these punctuations into half-width.
290+
// Convert these punctuations into halfwidth.
291291
// default preset: `()`
292292
// e.g. `(文字)` -> `(文字)`
293-
halfWidthPunctuation?: string
293+
halfwidthPunctuation?: string
294294

295-
// Convert these punctuations into full-width.
295+
// Convert these punctuations into fullwidth.
296296
// default preset: `,。:;?!“”‘’`
297297
// e.g. `文字,文字.` -> `文字,文字。`
298-
fullWidthPunctuation?: string
298+
fullwidthPunctuation?: string
299299

300-
// Treat these full-width punctuations as half-fullWidthPunctuation
300+
// Treat these fullwidth punctuations as half-fullWidthPunctuation
301301
// when processing the spaces issues around them.
302302
// Since something like quotations in morder Chinese fonts are
303-
// only rendered in half-width.
303+
// only rendered in halfwidth.
304304
// default preset: `“”‘’`
305-
adjustedFullWidthPunctuation?: string
305+
adjustedFullwidthPunctuation?: string
306306

307307
// Convert traditional Chinese punctuations into simplified ones or vice versa.
308308
// default preset: `simplified`
309309
// e.g. `「文字」` -> `“文字”`
310-
unifiedPunctuation?: 'traditional' | 'simplified'
310+
//
311+
// besides the above, we also unify some common punctuations below:
312+
//
313+
// // U+2047 DOUBLE QUESTION MARK, U+203C DOUBLE EXCLAMATION MARK
314+
// // U+2048 QUESTION EXCLAMATION MARK, U+2049 EXCLAMATION QUESTION MARK
315+
// '??': ['⁇'],
316+
// '!!': ['‼'],
317+
// '?!': ['⁈'],
318+
// '!?': ['⁉'],
319+
//
320+
// // U+002F SOLIDUS, U+FF0F FULLWIDTH SOLIDUS
321+
// '/': ['/', '/'],
322+
//
323+
// // U+FF5E FULLWIDTH TILDE
324+
// '~': ['~', '~'],
325+
//
326+
// // U+2026 HORIZONTAL ELLIPSIS, U+22EF MIDLINE HORIZONTAL ELLIPSIS
327+
// '…': ['…', '⋯'],
328+
//
329+
// // U+25CF BLACK CIRCLE, U+2022 BULLET, U+00B7 MIDDLE DOT,
330+
// // U+2027 HYPHENATION POINT, U+30FB KATAKANA MIDDLE DOT
331+
// '·': ['●', '•', '·', '‧', '・'],
332+
//
333+
// advanced usage: you can also specify a more detailed map like:
334+
//
335+
// ```
336+
// {
337+
// default: true, // follow all the default preset
338+
// '「': ['“', '【'], // convert `“` or `【` into `「`
339+
// '」': ['”', '】'], // convert `”` or `】` into `」`
340+
// '…': true, // follow the default preset for this character
341+
// '·': false, // not unify any of these characters
342+
// }
343+
// ```
344+
unifiedPunctuation?: 'traditional' | 'simplified' | Record<string, boolean | string[]> & { default: boolean }
311345

312346
// Special case: skip `fullWidthPunctuation` for abbreviations.
313347
// default preset:
@@ -320,21 +354,21 @@ type RuleOptions = {
320354
// - `true`: one space
321355
// - `undefined`: do nothing
322356
// e.g. `foo bar` -> `foo bar`
323-
spaceBetweenHalfWidthLetters?: boolean
357+
spaceBetweenHalfwidthContent?: boolean
324358

325359
// default preset: `true`
326360
// - `true`: zero space
327361
// - `undefined`: do nothing
328362
// e.g. `文 字` -> `文字`
329-
noSpaceBetweenFullWidthLetters?: boolean
363+
noSpaceBetweenFullwidthContent?: boolean
330364

331365
// default preset: `true`
332366
// - `true`: one space
333367
// - `false`: zero space
334368
// - `undefined`: do nothing
335369
// e.g. `文字 foo文字` -> `文字 foo 文字` (`true`)
336370
// e.g. `文字foo 文字` -> `文字foo文字` (`false`)
337-
spaceBetweenMixedWidthLetters?: boolean
371+
spaceBetweenMixedwidthContent?: boolean
338372

339373
// Special case: skip `spaceBetweenMixedWidthContent`
340374
// for numbers x Chinese units.
@@ -347,21 +381,21 @@ type RuleOptions = {
347381
// - `true`: zero space
348382
// - `undefined`: do nothing
349383
// e.g. `文字 ,文字` -> `文字,文字`
350-
noSpaceBeforePunctuation?: boolean
384+
noSpaceBeforePauseOrStop?: boolean
351385

352386
// default preset: `true`
353387
// - `true`: one space
354388
// - `false`: zero space
355389
// - `undefined`: do nothing
356390
// e.g. `文字,文字` -> `文字, 文字` (`true`)
357391
// e.g. `文字, 文字` -> `文字,文字` (`false`)
358-
spaceAfterHalfWidthPunctuation?: boolean
392+
spaceAfterHalfwidthPauseOrStop?: boolean
359393

360394
// default preset: `true`
361395
// - `true`: zero space
362396
// - `undefined`: do nothing
363397
// e.g. `文字, 文字` -> `文字,文字`
364-
noSpaceAfterFullWidthPunctuation?: boolean
398+
noSpaceAfterFullwidthPauseOrStop?: boolean
365399

366400
/* SPACES AROUND QUOTES */
367401

@@ -371,32 +405,32 @@ type RuleOptions = {
371405
// - `undefined`: do nothing
372406
// e.g. `文字 "文字"文字` -> `文字 "文字" 文字` (`true`)
373407
// e.g. `文字"文字" 文字` -> `文字"文字"文字` (`false`)
374-
spaceOutsideHalfQuote?: boolean
408+
spaceOutsideHalfwidthQuotation?: boolean
375409

376410
// default preset: `true`
377411
// - `true`: zero space
378412
// - `undefined`: do nothing
379413
// e.g. `文字 “文字” 文字` -> `文字“文字”文字`
380-
noSpaceOutsideFullQuote?: boolean
414+
noSpaceOutsideFullwidthQuotation?: boolean
381415

382416
// default preset: `true`
383417
// - `true`: zero space
384418
// - `undefined`: do nothing
385419
// e.g. `文字“ 文字 ”文字` -> `文字“文字”文字`
386-
noSpaceInsideQuote?: boolean
420+
noSpaceInsideQuotation?: boolean
387421

388422
/* SPACES AROUND BRACKETS */
389423

390424
// default preset: `true`
391425
// - `true`: one space
392426
// - `false`: zero space
393427
// - `undefined`: do nothing
394-
spaceOutsideHalfBracket?: boolean
428+
spaceOutsideHalfwidthBracket?: boolean
395429

396430
// default preset: `true`
397431
// - `true`: zero space
398432
// - `undefined`: do nothing
399-
noSpaceOutsideFullBracket?: boolean
433+
noSpaceOutsideFullwidthBracket?: boolean
400434

401435
// default preset: `true`
402436
// - `true`: zero space
@@ -419,7 +453,7 @@ type RuleOptions = {
419453
// - `true`: zero space
420454
// - `undefined`: do nothing
421455
// e.g. `文字** foo **文字` -> `文字 **foo** 文字`
422-
noSpaceInsideWrapper?: boolean
456+
noSpaceInsideHyperMark?: boolean
423457

424458
/* SPACES AT THE BEGINNING/END */
425459

README.zh-CN.md

+54-21
Original file line numberDiff line numberDiff line change
@@ -199,27 +199,61 @@ type RuleOptions = {
199199

200200
/* PUNCTUATIONS */
201201

202-
// Convert these punctuations into half-width.
202+
// Convert these punctuations into halfwidth.
203203
// default preset: `()`
204204
// e.g. `(文字)` -> `(文字)`
205-
halfWidthPunctuation?: string
205+
halfwidthPunctuation?: string
206206

207-
// Convert these punctuations into full-width.
207+
// Convert these punctuations into fullwidth.
208208
// default preset: `,。:;?!“”‘’`
209209
// e.g. `文字,文字.` -> `文字,文字。`
210-
fullWidthPunctuation?: string
210+
fullwidthPunctuation?: string
211211

212-
// Treat these full-width punctuations as half-fullWidthPunctuation
212+
// Treat these fullwidth punctuations as half-fullWidthPunctuation
213213
// when processing the spaces issues around them.
214214
// Since something like quotations in morder Chinese fonts are
215-
// only rendered in half-width.
215+
// only rendered in halfwidth.
216216
// default preset: `“”‘’`
217-
adjustedFullWidthPunctuation?: string
217+
adjustedFullwidthPunctuation?: string
218218

219219
// Convert traditional Chinese punctuations into simplified ones or vice versa.
220220
// default preset: `simplified`
221221
// 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 }
223257

224258
// Special case: skip `fullWidthPunctuation` for abbreviations.
225259
// default preset:
@@ -232,21 +266,21 @@ type RuleOptions = {
232266
// - `true`: one space
233267
// - `undefined`: do nothing
234268
// e.g. `foo bar` -> `foo bar`
235-
spaceBetweenHalfWidthLetters?: boolean
269+
spaceBetweenHalfwidthContent?: boolean
236270

237271
// default preset: `true`
238272
// - `true`: zero space
239273
// - `undefined`: do nothing
240274
// e.g. `文 字` -> `文字`
241-
noSpaceBetweenFullWidthLetters?: boolean
275+
noSpaceBetweenFullwidthContent?: boolean
242276

243277
// default preset: `true`
244278
// - `true`: one space
245279
// - `false`: zero space
246280
// - `undefined`: do nothing
247281
// e.g. `文字 foo文字` -> `文字 foo 文字` (`true`)
248282
// e.g. `文字foo 文字` -> `文字foo文字` (`false`)
249-
spaceBetweenMixedWidthLetters?: boolean
283+
spaceBetweenMixedwidthContent?: boolean
250284

251285
// Special case: skip `spaceBetweenMixedWidthContent`
252286
// for numbers x Chinese units.
@@ -259,21 +293,21 @@ type RuleOptions = {
259293
// - `true`: zero space
260294
// - `undefined`: do nothing
261295
// e.g. `文字 ,文字` -> `文字,文字`
262-
noSpaceBeforePunctuation?: boolean
296+
noSpaceBeforePauseOrStop?: boolean
263297

264298
// default preset: `true`
265299
// - `true`: one space
266300
// - `false`: zero space
267301
// - `undefined`: do nothing
268302
// e.g. `文字,文字` -> `文字, 文字` (`true`)
269303
// e.g. `文字, 文字` -> `文字,文字` (`false`)
270-
spaceAfterHalfWidthPunctuation?: boolean
304+
spaceAfterHalfwidthPauseOrStop?: boolean
271305

272306
// default preset: `true`
273307
// - `true`: zero space
274308
// - `undefined`: do nothing
275309
// e.g. `文字, 文字` -> `文字,文字`
276-
noSpaceAfterFullWidthPunctuation?: boolean
310+
noSpaceAfterFullwidthPauseOrStop?: boolean
277311

278312
/* SPACES AROUND QUOTES */
279313

@@ -283,32 +317,32 @@ type RuleOptions = {
283317
// - `undefined`: do nothing
284318
// e.g. `文字 "文字"文字` -> `文字 "文字" 文字` (`true`)
285319
// e.g. `文字"文字" 文字` -> `文字"文字"文字` (`false`)
286-
spaceOutsideHalfQuote?: boolean
320+
spaceOutsideHalfwidthQuotation?: boolean
287321

288322
// default preset: `true`
289323
// - `true`: zero space
290324
// - `undefined`: do nothing
291325
// e.g. `文字 “文字” 文字` -> `文字“文字”文字`
292-
noSpaceOutsideFullQuote?: boolean
326+
noSpaceOutsideFullwidthQuotation?: boolean
293327

294328
// default preset: `true`
295329
// - `true`: zero space
296330
// - `undefined`: do nothing
297331
// e.g. `文字“ 文字 ”文字` -> `文字“文字”文字`
298-
noSpaceInsideQuote?: boolean
332+
noSpaceInsideQuotation?: boolean
299333

300334
/* SPACES AROUND BRACKETS */
301335

302336
// default preset: `true`
303337
// - `true`: one space
304338
// - `false`: zero space
305339
// - `undefined`: do nothing
306-
spaceOutsideHalfBracket?: boolean
340+
spaceOutsideHalfwidthBracket?: boolean
307341

308342
// default preset: `true`
309343
// - `true`: zero space
310344
// - `undefined`: do nothing
311-
noSpaceOutsideFullBracket?: boolean
345+
noSpaceOutsideFullwidthBracket?: boolean
312346

313347
// default preset: `true`
314348
// - `true`: zero space
@@ -331,7 +365,7 @@ type RuleOptions = {
331365
// - `true`: zero space
332366
// - `undefined`: do nothing
333367
// e.g. `文字** foo **文字` -> `文字 **foo** 文字`
334-
noSpaceInsideWrapper?: boolean
368+
noSpaceInsideHyperMark?: boolean
335369

336370
/* SPACES AT THE BEGINNING/END */
337371

@@ -340,4 +374,3 @@ type RuleOptions = {
340374
trimSpace?: boolean
341375
}
342376
```
343-

0 commit comments

Comments
 (0)