@@ -50,6 +50,7 @@ will not do.
50
50
- [ Examples] ( #examples )
51
51
- [ Using the Default Configuration] ( #using-the-default-configuration )
52
52
- [ Using ` excludeHeadingLevel ` ] ( #using-excludeheadinglevel )
53
+ - [ Using ` excludeHeadingText ` ] ( #using-excludeheadingtext )
53
54
- [ Using ` excludeSectionRegExp ` ] ( #using-excludesectionregexp )
54
55
- [ Using ` replaceHeadingRegExp ` ] ( #using-replaceheadingregexp )
55
56
- [ Related] ( #related )
@@ -236,7 +237,7 @@ Suppose we have the following Markdown file `example.md`:
236
237
237
238
#### Additional option: `options.opt3`
238
239
239
- ## Section 3 has the rest
240
+ ## Section 3 has the rest {#section-three}
240
241
241
242
### Subsection [a][1]
242
243
@@ -307,8 +308,8 @@ Would output the following compared to `example.md`:
307
308
- #### Additional option: `options.opt3`
308
309
+ #### Additional Option: `options.opt3`
309
310
310
- - ## Section 3 has the rest
311
- + ## Section 3 Has the Rest
311
+ - ## Section 3 has the rest {#section-three}
312
+ + ## Section 3 Has the Rest {#section-Three}
312
313
313
314
# ## Subsection [a][1]
314
315
@@ -380,8 +381,81 @@ Would output the following compared to `example.md`:
380
381
381
382
# ### Additional option: `options.opt3`
382
383
383
- - ## Section 3 has the rest
384
- + ## Section 3 Has the Rest
384
+ - ## Section 3 has the rest {#section-three}
385
+ + ## Section 3 Has the Rest {#section-Three}
386
+
387
+ # ## Subsection [a][1]
388
+
389
+ # ### Sci-fi title generator
390
+
391
+ - ##### children of celeste
392
+ + ##### Children of Celeste
393
+
394
+ - ##### the bionic oblivion
395
+ + ##### The Bionic Oblivion
396
+
397
+ - ##### snows Of arrakis
398
+ + ##### Snows of Arrakis
399
+
400
+ [1]: https://www.youtube.com/watch?v=dFs4yX4V7NQ
401
+ ```
402
+
403
+ ### Using ` excludeHeadingText `
404
+
405
+ Running the following JavaScript:
406
+
407
+ ``` typescript
408
+ import { read } from ' to-vfile' ;
409
+ import { remark } from ' remark' ;
410
+ import remarkCapitalizeHeadings from ' remark-capitalize-headings' ;
411
+
412
+ const file = await remark ()
413
+ .use (remarkCapitalizeHeadings , {
414
+ // Don't mess with {#custom-headers} from remark-heading-id
415
+ // See: https://github.com/Xunnamius/unified-utils/issues/95
416
+ excludeHeadingText: [' \\ {\\ s*#.*?\\ }\\ s*$' ]
417
+ })
418
+ .process (await read (' example.md' ));
419
+
420
+ console .log (String (file ));
421
+ ```
422
+
423
+ Would output the following compared to ` example.md ` :
424
+
425
+ ``` diff
426
+ - # my documentation
427
+ + # My Documentation
428
+
429
+ - ## Section 1 is [the best](https://google.com)
430
+ + ## Section 1 Is [the best](https://google.com)
431
+
432
+ # ## Subsection a
433
+
434
+ # ## Subsection _a_
435
+
436
+ # ## Subsection \_a
437
+
438
+ # ## Subsection a: be see
439
+
440
+ # ## Subsection b
441
+
442
+ # ## Subsection C
443
+
444
+ - ## section 2 is the test
445
+ + ## Section 2 Is the Test
446
+
447
+ # ## subsection 1
448
+
449
+ # ## Subsection 2
450
+
451
+ # ### `options.opt1`
452
+
453
+ # ### `options.opt2`
454
+
455
+ # ### Additional option: `options.opt3`
456
+
457
+ - ## Section 3 has the rest {#section-three}
458
+ + ## Section 3 Has the Rest {#section-three}
385
459
386
460
# ## Subsection [a][1]
387
461
@@ -453,8 +527,8 @@ Would output the following compared to `example.md`:
453
527
454
528
# ### Additional option: `options.opt3`
455
529
456
- - ## Section 3 has the rest
457
- + ## Section 3 Has the Rest
530
+ - ## Section 3 has the rest {#section-three}
531
+ + ## Section 3 Has the Rest {#section-Three}
458
532
459
533
# ## Subsection [a][1]
460
534
@@ -532,8 +606,8 @@ Would output the following compared to `example.md`:
532
606
- #### Additional option: `options.opt3`
533
607
+ #### Additional Option: `options.opt3`
534
608
535
- - ## Section 3 has the rest
536
- + ## Section 3 Has The Rest
609
+ - ## Section 3 has the rest {#section-three}
610
+ + ## Section 3 Has The Rest {#section-Three}
537
611
538
612
# ## Subsection [a][1]
539
613
0 commit comments