Skip to content

Commit 4790600

Browse files
modify examples
1 parent 18ba71f commit 4790600

File tree

7 files changed

+634
-261
lines changed

7 files changed

+634
-261
lines changed

README_zh.md

Lines changed: 70 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"description": "A gitBook plugin for generating and exporting mind map within markdown"
3434
}
3535
```
36-
3736
```json
3837
{
3938
"name": "gitbook-plugin-diff",
@@ -46,24 +45,16 @@
4645

4746
- 预览
4847

49-
{% diff method="diffJson" %}
50-
```json
48+
```diff
5149
{
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"
5555
}
5656
```
5757

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-
6758
## 用法
6859

6960
### 步骤#1-更新 `book.json` 文件
@@ -111,7 +102,6 @@
111102
```
112103
old code
113104
```
114-
115105
```
116106
new code
117107
```
@@ -143,7 +133,6 @@ new code
143133
```js
144134
cat
145135
```
146-
147136
```js
148137
cap
149138
```
@@ -152,16 +141,12 @@ cap
152141

153142
- 预览
154143

155-
{% diff method="diffChars" %}
156-
```js
157-
cat
144+
```diff
145+
ca
146+
- t
147+
+ p
158148
```
159149

160-
```js
161-
cap
162-
```
163-
{% enddiff %}
164-
165150
#### `Diff.diffWords(oldStr, newStr[, options])`
166151

167152
> 区分两个文本块,逐字比较,忽略空格。
@@ -185,7 +170,6 @@ cap
185170
```bash
186171
beep boop
187172
```
188-
189173
```bash
190174
beep boob blah
191175
```
@@ -194,15 +178,13 @@ beep boob blah
194178

195179
- 预览
196180

197-
{% diff method="diffWords" %}
198-
```bash
199-
beep boop
200-
```
181+
```diff
182+
beep
183+
- boop
184+
+ boob
201185

202-
```bash
203-
beep boob blah
186+
+ blah
204187
```
205-
{% enddiff %}
206188

207189
#### `Diff.diffWordsWithSpace(oldStr, newStr[, options])`
208190

@@ -227,7 +209,6 @@ beep boob blah
227209
```bash
228210
beep boop
229211
```
230-
231212
```bash
232213
beep boob blah
233214
```
@@ -236,16 +217,12 @@ beep boob blah
236217

237218
- 预览
238219

239-
{% diff method="diffWordsWithSpace" %}
240-
```bash
241-
beep boop
220+
```diff
221+
beep
222+
- boop
223+
+ boob blah
242224
```
243225

244-
```bash
245-
beep boob blah
246-
```
247-
{% enddiff %}
248-
249226
#### `Diff.diffLines(oldStr, newStr[, options])`
250227

251228
> 比较两个文本块,逐行比较。
@@ -272,7 +249,6 @@ beep boop
272249
the cat is palying with cap
273250
what
274251
```
275-
276252
```bash
277253
beep boob blah
278254
the cat is palying with cap
@@ -283,19 +259,17 @@ who
283259

284260
- 预览
285261

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
292264

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
297272
```
298-
{% enddiff %}
299273

300274
#### `Diff.diffTrimmedLines(oldStr, newStr[, options])`
301275

@@ -323,7 +297,6 @@ beep boop
323297
the cat is palying with cap
324298
what
325299
```
326-
327300
```bash
328301
beep boob blah
329302
the cat is palying with cat
@@ -334,19 +307,15 @@ who
334307

335308
- 预览
336309

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
343314

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
348318
```
349-
{% enddiff %}
350319

351320
#### `Diff.diffSentences(oldStr, newStr[, options])`
352321

@@ -369,7 +338,6 @@ beep boop
369338
the cat is palying with cap
370339
what
371340
```
372-
373341
```bash
374342
beep boob blah
375343
the cat is palying with cat
@@ -380,19 +348,15 @@ who
380348

381349
- 预览
382350

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
389355

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
394359
```
395-
{% enddiff %}
396360

397361
#### `Diff.diffCss(oldStr, newStr[, options])`
398362

@@ -417,7 +381,6 @@ who
417381
font-weight: 700;
418382
}
419383
```
420-
421384
```css
422385
.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6 {
423386
margin-top: 1.5em;
@@ -429,22 +392,21 @@ who
429392

430393
- 预览
431394

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+
-
437406
font-weight: 700;
438-
}
439-
```
440407

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;
445408
}
446409
```
447-
{% enddiff %}
448410

449411
#### `Diff.diffJson(oldObj, newObj[, options])`
450412

@@ -469,7 +431,6 @@ who
469431
"description": "A gitBook plugin for generating and exporting mind map within markdown"
470432
}
471433
```
472-
473434
```json
474435
{
475436
"name": "gitbook-plugin-diff",
@@ -482,23 +443,15 @@ who
482443

483444
- 预览
484445

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
495447
{
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"
499453
}
500454
```
501-
{% enddiff %}
502455

503456
#### `Diff.diffArrays(oldArr, newArr[, options])`
504457

@@ -532,7 +485,6 @@ who
532485
"小程序"
533486
]
534487
```
535-
536488
```json
537489
[
538490
"Vuejs",
@@ -549,32 +501,20 @@ who
549501

550502
- 预览
551503

552-
{% diff method="diffArrays" %}
553-
```json
504+
```diff
554505
[
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+
- 小程序
575516
]
576517
```
577-
{% enddiff %}
578518

579519
### 步骤#3- 运行 `gitbook` 命令
580520

docs/book.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"github-buttons",
1414
"edit-link-plus",
1515
"readmore",
16-
"copy-code-button",
16+
"copyright",
1717
"mygitalk",
1818
"icp",
1919
"diff"

0 commit comments

Comments
 (0)