33
33
"description": "A gitBook plugin for generating and exporting mind map within markdown"
34
34
}
35
35
```
36
-
37
36
```json
38
37
{
39
38
"name": "gitbook-plugin-diff",
46
45
47
46
- 预览
48
47
49
- {% diff method="diffJson" %}
50
- ``` json
48
+ ``` diff
51
49
{
52
- "name" : " gitbook-plugin-simple-mind-map" ,
53
- "version" : " 0.2.1" ,
54
- "description" : " A gitBook plugin for generating and exporting mind map within markdown"
50
+ - "description": "A gitBook plugin for generating and exporting mind map within markdown",
51
+ - "name": "gitbook-plugin-simple-mind-map",
52
+ + "description": "A gitbook plugin for showing the differences between the codes within markdown",
53
+ + "name": "gitbook-plugin-diff",
54
+ "version": "0.2.1"
55
55
}
56
56
```
57
57
58
- ``` json
59
- {
60
- "name" : " gitbook-plugin-diff" ,
61
- "version" : " 0.2.1" ,
62
- "description" : " A gitbook plugin for showing the differences between the codes within markdown"
63
- }
64
- ```
65
- {% enddiff %}
66
-
67
58
## 用法
68
59
69
60
### 步骤#1-更新 ` book.json ` 文件
111
102
```
112
103
old code
113
104
```
114
-
115
105
```
116
106
new code
117
107
```
@@ -143,7 +133,6 @@ new code
143
133
```js
144
134
cat
145
135
```
146
-
147
136
```js
148
137
cap
149
138
```
@@ -152,16 +141,12 @@ cap
152
141
153
142
- 预览
154
143
155
- {% diff method="diffChars" %}
156
- ``` js
157
- cat
144
+ ``` diff
145
+ ca
146
+ - t
147
+ + p
158
148
```
159
149
160
- ``` js
161
- cap
162
- ```
163
- {% enddiff %}
164
-
165
150
#### ` Diff.diffWords(oldStr, newStr[, options]) `
166
151
167
152
> 区分两个文本块,逐字比较,忽略空格。
185
170
```bash
186
171
beep boop
187
172
```
188
-
189
173
```bash
190
174
beep boob blah
191
175
```
@@ -194,15 +178,13 @@ beep boob blah
194
178
195
179
- 预览
196
180
197
- {% diff method="diffWords" %}
198
- ``` bash
199
- beep boop
200
- ```
181
+ ``` diff
182
+ beep
183
+ - boop
184
+ + boob
201
185
202
- ``` bash
203
- beep boob blah
186
+ + blah
204
187
```
205
- {% enddiff %}
206
188
207
189
#### ` Diff.diffWordsWithSpace(oldStr, newStr[, options]) `
208
190
@@ -227,7 +209,6 @@ beep boob blah
227
209
```bash
228
210
beep boop
229
211
```
230
-
231
212
```bash
232
213
beep boob blah
233
214
```
@@ -236,16 +217,12 @@ beep boob blah
236
217
237
218
- 预览
238
219
239
- {% diff method="diffWordsWithSpace" %}
240
- ``` bash
241
- beep boop
220
+ ``` diff
221
+ beep
222
+ - boop
223
+ + boob blah
242
224
```
243
225
244
- ``` bash
245
- beep boob blah
246
- ```
247
- {% enddiff %}
248
-
249
226
#### ` Diff.diffLines(oldStr, newStr[, options]) `
250
227
251
228
> 比较两个文本块,逐行比较。
@@ -272,7 +249,6 @@ beep boop
272
249
the cat is palying with cap
273
250
what
274
251
```
275
-
276
252
```bash
277
253
beep boob blah
278
254
the cat is palying with cap
@@ -283,19 +259,17 @@ who
283
259
284
260
- 预览
285
261
286
- {% diff method="diffLines",options={"newlineIsToken": true } %}
287
- ``` bash
288
- beep boop
289
- the cat is palying with cap
290
- what
291
- ```
262
+ ``` diff
263
+ - beep boop
292
264
293
- ``` bash
294
- beep boob blah
295
- the cat is palying with cap
296
- who
265
+ + beep boob blah
266
+
267
+ the cat is palying with cap
268
+
269
+ - what
270
+
271
+ + who
297
272
```
298
- {% enddiff %}
299
273
300
274
#### ` Diff.diffTrimmedLines(oldStr, newStr[, options]) `
301
275
@@ -323,7 +297,6 @@ beep boop
323
297
the cat is palying with cap
324
298
what
325
299
```
326
-
327
300
```bash
328
301
beep boob blah
329
302
the cat is palying with cat
@@ -334,19 +307,15 @@ who
334
307
335
308
- 预览
336
309
337
- {% diff method="diffTrimmedLines",options={"newlineIsToken": true } %}
338
- ``` bash
339
- beep boop
340
- the cat is palying with cap
341
- what
342
- ```
310
+ ``` diff
311
+ - beep boop
312
+ the cat is palying with cap
313
+ what
343
314
344
- ``` bash
345
- beep boob blah
346
- the cat is palying with cat
347
- who
315
+ + beep boob blah
316
+ the cat is palying with cat
317
+ who
348
318
```
349
- {% enddiff %}
350
319
351
320
#### ` Diff.diffSentences(oldStr, newStr[, options]) `
352
321
@@ -369,7 +338,6 @@ beep boop
369
338
the cat is palying with cap
370
339
what
371
340
```
372
-
373
341
```bash
374
342
beep boob blah
375
343
the cat is palying with cat
@@ -380,19 +348,15 @@ who
380
348
381
349
- 预览
382
350
383
- {% diff method="diffSentences" %}
384
- ``` bash
385
- beep boop
386
- the cat is palying with cap
387
- what
388
- ```
351
+ ``` diff
352
+ - beep boop
353
+ the cat is palying with cap
354
+ what
389
355
390
- ``` bash
391
- beep boob blah
392
- the cat is palying with cat
393
- who
356
+ + beep boob blah
357
+ the cat is palying with cat
358
+ who
394
359
```
395
- {% enddiff %}
396
360
397
361
#### ` Diff.diffCss(oldStr, newStr[, options]) `
398
362
417
381
font-weight: 700;
418
382
}
419
383
```
420
-
421
384
```css
422
385
.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6 {
423
386
margin-top: 1.5em;
@@ -429,22 +392,21 @@ who
429
392
430
393
- 预览
431
394
432
- {% diff method="diffCss" %}
433
- ``` css
434
- .markdown-section h1 , .markdown-section h2 , .markdown-section h3 , .markdown-section h4 , .markdown-section h5 , .markdown-section h6 {
435
- margin-top : 1.275em ;
436
- margin-bottom : .85em ;
395
+ ``` diff
396
+ .markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6 {
397
+ margin-top:
398
+ - 1.275em
399
+ + 1.5em
400
+ ;
401
+ margin-bottom:
402
+ - .85em
403
+ + 1em
404
+ ;
405
+ -
437
406
font-weight: 700;
438
- }
439
- ```
440
407
441
- ``` css
442
- .markdown-section h1 , .markdown-section h2 , .markdown-section h3 , .markdown-section h4 , .markdown-section h5 , .markdown-section h6 {
443
- margin-top : 1.5em ;
444
- margin-bottom : 1em ;
445
408
}
446
409
```
447
- {% enddiff %}
448
410
449
411
#### ` Diff.diffJson(oldObj, newObj[, options]) `
450
412
469
431
"description": "A gitBook plugin for generating and exporting mind map within markdown"
470
432
}
471
433
```
472
-
473
434
```json
474
435
{
475
436
"name": "gitbook-plugin-diff",
@@ -482,23 +443,15 @@ who
482
443
483
444
- 预览
484
445
485
- {% diff method="diffJson" %}
486
- ``` json
487
- {
488
- "name" : " gitbook-plugin-simple-mind-map" ,
489
- "version" : " 0.2.1" ,
490
- "description" : " A gitBook plugin for generating and exporting mind map within markdown"
491
- }
492
- ```
493
-
494
- ``` json
446
+ ``` diff
495
447
{
496
- "name" : " gitbook-plugin-diff" ,
497
- "version" : " 0.2.1" ,
498
- "description" : " A gitbook plugin for showing the differences between the codes within markdown"
448
+ - "description": "A gitBook plugin for generating and exporting mind map within markdown",
449
+ - "name": "gitbook-plugin-simple-mind-map",
450
+ + "description": "A gitbook plugin for showing the differences between the codes within markdown",
451
+ + "name": "gitbook-plugin-diff",
452
+ "version": "0.2.1"
499
453
}
500
454
```
501
- {% enddiff %}
502
455
503
456
#### ` Diff.diffArrays(oldArr, newArr[, options]) `
504
457
532
485
"小程序"
533
486
]
534
487
```
535
-
536
488
```json
537
489
[
538
490
"Vuejs",
@@ -549,32 +501,20 @@ who
549
501
550
502
- 预览
551
503
552
- {% diff method="diffArrays" %}
553
- ``` json
504
+ ``` diff
554
505
[
555
- " Vue" ,
556
- " Python" ,
557
- " Java" ,
558
- " flutter" ,
559
- " springboot" ,
560
- " docker" ,
561
- " React" ,
562
- " 小程序"
563
- ]
564
- ```
565
-
566
- ``` json
567
- [
568
- " Vuejs" ,
569
- " Nodejs" ,
570
- " Java" ,
571
- " flutter" ,
572
- " springboot" ,
573
- " docker" ,
574
- " React"
506
+ - Vue
507
+ - Python
508
+ + Vuejs
509
+ + Nodejs
510
+ Java
511
+ flutter
512
+ springboot
513
+ docker
514
+ React
515
+ - 小程序
575
516
]
576
517
```
577
- {% enddiff %}
578
518
579
519
### 步骤#3- 运行 ` gitbook ` 命令
580
520
0 commit comments