Skip to content

Commit 956fb60

Browse files
committed
docs(README): add #anchor and improve notes
1 parent eef7ea3 commit 956fb60

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

README.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Match files using the patterns the shell uses.
44

55
The most correct and second fastest glob implementation in
6-
JavaScript. (See **Comparison to Other JavaScript Glob
7-
Implementations** at the bottom of this readme.)
6+
JavaScript. (See [**Comparison to Other JavaScript Glob
7+
Implementations**](#comparisons-to-other-fnmatchglob-implementations) at the bottom of this readme.)
88

99
![a fun cartoon logo made of glob characters](https://github.com/isaacs/node-glob/raw/main/logo/glob.png)
1010

@@ -16,7 +16,8 @@ Install with npm
1616
npm i glob
1717
```
1818

19-
**Note** the npm package name is _not_ `node-glob` that's a
19+
> [!NOTE]
20+
> The npm package name is _not_ `node-glob` that's a
2021
different thing that was abandoned years ago. Just `glob`.
2122

2223
```js
@@ -135,7 +136,8 @@ const newFiles = await glob('**', {
135136
})
136137
```
137138

138-
**Note** Glob patterns should always use `/` as a path separator,
139+
> [!NOTE]
140+
> Glob patterns should always use `/` as a path separator,
139141
even on Windows systems, as `\` is used to escape glob
140142
characters. If you wish to use `\` as a path separator _instead
141143
of_ using it as an escape character on Windows platforms, you may
@@ -362,7 +364,8 @@ Options object is required.
362364

363365
See full options descriptions below.
364366

365-
Note that a previous `Glob` object can be passed as the
367+
> [!NOTE]
368+
> A previous `Glob` object can be passed as the
366369
`GlobOptions` to another `Glob` instantiation to re-use settings
367370
and caches with a new pattern.
368371

@@ -429,7 +432,8 @@ share the previously loaded cache.
429432
is used as the starting point for absolute patterns that start
430433
with `/`, (but not drive letters or UNC paths on Windows).
431434

432-
Note that this _doesn't_ necessarily limit the walk to the
435+
> [!NOTE]
436+
> This _doesn't_ necessarily limit the walk to the
433437
`root` directory, and doesn't affect the cwd starting point for
434438
non-absolute patterns. A pattern containing `..` will still be
435439
able to traverse out of the root directory, if it is not an
@@ -440,17 +444,17 @@ share the previously loaded cache.
440444
`*` with `{root:'/some/path'}` will return all the entries in
441445
the cwd, not the entries in `/some/path`.
442446

443-
To start absolute and non-absolute patterns in the same
444-
path, you can use `{root:''}`. However, be aware that on
445-
Windows systems, a pattern like `x:/*` or `//host/share/*` will
446-
_always_ start in the `x:/` or `//host/share` directory,
447-
regardless of the `root` setting.
447+
    To start absolute and non-absolute patterns in the same path,
448+
you can use `{root:''}`. However, be aware that on Windows systems,
449+
    a pattern like `x:/*` or `//host/share/*` will _always_ start in the
450+
`x:/` or `//host/share` directory, regardless of the `root` setting.
448451

449452
- `windowsPathsNoEscape` Use `\\` as a path separator _only_, and
450453
_never_ as an escape character. If set, all `\\` characters are
451454
replaced with `/` in the pattern.
452455

453-
Note that this makes it **impossible** to match against paths
456+
> [!NOTE]
457+
> This makes it **impossible** to match against paths
454458
containing literal glob pattern characters, but allows matching
455459
with patterns constructed using `path.join()` and
456460
`path.resolve()` on Windows platforms, mimicking the (buggy!)
@@ -492,7 +496,8 @@ share the previously loaded cache.
492496
- `nocase` Perform a case-insensitive match. This defaults to
493497
`true` on macOS and Windows systems, and `false` on all others.
494498

495-
**Note** `nocase` should only be explicitly set when it is
499+
> [!NOTE]
500+
> `nocase` should only be explicitly set when it is
496501
known that the filesystem's case sensitivity differs from the
497502
platform default. If set `true` on case-sensitive file
498503
systems, or `false` on case-insensitive file systems, then the
@@ -509,7 +514,8 @@ share the previously loaded cache.
509514
- `nodir` Do not match directories, only files. (Note: to match
510515
_only_ directories, put a `/` at the end of the pattern.)
511516

512-
Note: when `follow` and `nodir` are both set, then symbolic
517+
> [!NOTE]
518+
> When `follow` and `nodir` are both set, then symbolic
513519
links to directories are also omitted.
514520

515521
- `stat` Call `lstat()` on all entries, whether required or not
@@ -526,13 +532,14 @@ share the previously loaded cache.
526532
To ignore all children within a directory, as well as the entry
527533
itself, append `'/**'` to the ignore pattern.
528534

529-
**Note** `ignore` patterns are _always_ in `dot:true` mode,
535+
> [!NOTE]
536+
> `ignore` patterns are _always_ in `dot:true` mode,
530537
regardless of any other settings.
531538

532-
If an object is provided that has `ignored(path)` and/or
533-
`childrenIgnored(path)` methods, then these methods will be
534-
called to determine whether any Path is a match or if its
535-
children should be traversed, respectively.
539+
     If an object is provided that has `ignored(path)` and/or
540+
`childrenIgnored(path)` methods, then these methods will be called to
541+
     determine whether any Path is a match or if its children should
542+
be traversed, respectively.
536543

537544
- `follow` Follow symlinked directories when expanding `**`
538545
patterns. This can result in a lot of duplicate references in
@@ -542,7 +549,8 @@ share the previously loaded cache.
542549
it is not the first item in the pattern, or none if it is the
543550
first item in the pattern, following the same behavior as Bash.
544551

545-
Note: when `follow` and `nodir` are both set, then symbolic
552+
> [!NOTE]
553+
> When `follow` and `nodir` are both set, then symbolic
546554
links to directories are also omitted.
547555

548556
- `realpath` Set to true to call `fs.realpath` on all of the
@@ -606,7 +614,8 @@ share the previously loaded cache.
606614
`false`, and a custom `Ignore` is provided that does not have
607615
an `add()` method, then it will throw an error.
608616

609-
**Caveat** It _only_ ignores matches that would be a descendant
617+
> [!NOTE]
618+
> It _only_ ignores matches that would be a descendant
610619
of a previous match, and only if that descendant is matched
611620
_after_ the ancestor is encountered. Since the file system walk
612621
happens in indeterminate order, it's possible that a match will
@@ -737,7 +746,8 @@ bsdglob and bash 5, where `**` only has special significance if
737746
it is the only thing in a path part. That is, `a/**/b` will match
738747
`a/x/y/b`, but `a/**b` will not.
739748

740-
Note that symlinked directories are not traversed as part of a
749+
> [!NOTE]
750+
> Symlinked directories are not traversed as part of a
741751
`**`, though their contents may match against subsequent portions
742752
of the pattern. This prevents infinite loops and duplicates and
743753
the like. You can force glob to traverse symlinks with `**` by
@@ -955,7 +965,8 @@ performing a glob pattern expansion as faithfully as possible to
955965
the behavior of Bash and other sh-like shells, with as much speed
956966
as possible.
957967

958-
Note that prior versions of `node-glob` are _not_ on this list.
968+
> [!NOTE]
969+
> Prior versions of `node-glob` are _not_ on this list.
959970
Former versions of this module are far too slow for any cases
960971
where performance matters at all, and were designed with APIs
961972
that are extremely dated by current JavaScript standards.

0 commit comments

Comments
 (0)