mdx-linklist 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +28 -34
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/mdx-linklist.svg)](https://www.npmjs.com/package/mdx-linklist)
5
5
  [![license](https://img.shields.io/npm/l/mdx-linklist.svg)](https://github.com/amandeepmittal/mdx-linklist/blob/main/LICENSE)
6
6
 
7
- A CLI tool to extract and validate links in MDX files. Check for broken internal links and external URLs in your documentation.
7
+ A CLI tool to extract and report broken links in MDX files. Check for broken internal links and external URLs in your documentation.
8
8
 
9
9
  ## Installation
10
10
 
@@ -15,7 +15,8 @@ npm install -g mdx-linklist
15
15
  Or run directly with npx:
16
16
 
17
17
  ```bash
18
- npx mdx-linklist check ./docs
18
+ # Check current directory
19
+ npx mdx-linklist check ./pages
19
20
  ```
20
21
 
21
22
  ## Usage
@@ -23,7 +24,11 @@ npx mdx-linklist check ./docs
23
24
  ### Basic Check
24
25
 
25
26
  ```bash
26
- mdx-linklist check ./docs
27
+ # Check specific directory
28
+ mdx-linklist check ./pages
29
+
30
+ # Check current directory
31
+ mdx-linklist check .
27
32
  ```
28
33
 
29
34
  ### Options
@@ -52,16 +57,16 @@ Options:
52
57
 
53
58
  ```bash
54
59
  # Check only internal links (faster, no network)
55
- mdx-linklist check ./docs --internal-only
60
+ mdx-linklist check ./pages --internal-only
56
61
 
57
62
  # Output as JSON
58
- mdx-linklist check ./docs --format json --output report.json
63
+ mdx-linklist check ./pages --format json --output report.json
59
64
 
60
65
  # Ignore localhost and specific domains
61
- mdx-linklist check ./docs --ignore "localhost:*" --ignore-domain "twitter.com"
66
+ mdx-linklist check ./pages --ignore "localhost:*" --ignore-domain "twitter.com"
62
67
 
63
68
  # Check with custom timeout
64
- mdx-linklist check ./docs --timeout 5000
69
+ mdx-linklist check ./pages --timeout 5000
65
70
 
66
71
  # Framework docs with route prefixes (e.g., Expo, Next.js, Docusaurus)
67
72
  mdx-linklist check ./docs \
@@ -77,9 +82,11 @@ Many documentation frameworks use route-style paths that map to files in a subdi
77
82
 
78
83
  ```markdown
79
84
  <!-- Link in MDX -->
85
+
80
86
  [Getting Started](/guides/intro)
81
87
 
82
88
  <!-- Actual file location -->
89
+
83
90
  pages/guides/intro.mdx
84
91
  ```
85
92
 
@@ -109,31 +116,34 @@ You can use CLI flags (recommended) or create a `mdx-linklist.config.json` file:
109
116
 
110
117
  ### Config Options
111
118
 
112
- | Option | Type | Default | Description |
113
- |--------|------|---------|-------------|
114
- | `include` | `string[]` | `["./**/*.mdx", "./**/*.md"]` | Glob patterns for files to scan |
115
- | `exclude` | `string[]` | `["**/node_modules/**", "**/dist/**", "**/.git/**"]` | Glob patterns to exclude |
116
- | `ignorePatterns` | `string[]` | `["localhost:*", "127.0.0.1:*", "*.local"]` | URL patterns to skip |
117
- | `ignoreDomains` | `string[]` | `[]` | Domains to skip |
118
- | `timeout` | `number` | `10000` | External request timeout (ms) |
119
- | `retries` | `number` | `2` | Retry count for failed requests |
120
- | `concurrency` | `number` | `10` | Parallel external requests |
121
- | `routePrefixes` | `string[]` | `[]` | Directory prefixes for absolute paths |
122
- | `customComponents` | `string[]` | `["Link", "A"]` | JSX components with href props |
119
+ | Option | Type | Default | Description |
120
+ | ------------------ | ---------- | ---------------------------------------------------- | ------------------------------------- |
121
+ | `include` | `string[]` | `["./**/*.mdx", "./**/*.md"]` | Glob patterns for files to scan |
122
+ | `exclude` | `string[]` | `["**/node_modules/**", "**/dist/**", "**/.git/**"]` | Glob patterns to exclude |
123
+ | `ignorePatterns` | `string[]` | `["localhost:*", "127.0.0.1:*", "*.local"]` | URL patterns to skip |
124
+ | `ignoreDomains` | `string[]` | `[]` | Domains to skip |
125
+ | `timeout` | `number` | `10000` | External request timeout (ms) |
126
+ | `retries` | `number` | `2` | Retry count for failed requests |
127
+ | `concurrency` | `number` | `10` | Parallel external requests |
128
+ | `routePrefixes` | `string[]` | `[]` | Directory prefixes for absolute paths |
129
+ | `customComponents` | `string[]` | `["Link", "A"]` | JSX components with href props |
123
130
 
124
131
  ## What It Checks
125
132
 
126
133
  ### Internal Links
134
+
127
135
  - Relative paths (`./page.mdx`, `../other/page.mdx`)
128
136
  - Absolute paths (`/docs/guide`)
129
137
  - Combined with anchors (`./page.mdx#section`) - validates file exists
130
138
 
131
139
  ### External Links
140
+
132
141
  - HTTP/HTTPS URLs
133
142
  - Follows redirects
134
143
  - Reports status codes
135
144
 
136
145
  ### JSX Components
146
+
137
147
  - `<Link href="...">`
138
148
  - `<A href="...">`
139
149
  - Custom components (configurable via `--component` flag)
@@ -195,22 +205,6 @@ mdx-linklist check ./docs --format json
195
205
  mdx-linklist check ./docs --format markdown --output report.md
196
206
  ```
197
207
 
198
- ## CI Integration
199
-
200
- The CLI exits with code 1 when broken links are found:
201
-
202
- ```yaml
203
- # GitHub Actions
204
- - name: Check links
205
- run: npx mdx-linklist check ./docs --internal-only
206
- ```
207
-
208
- Use `--no-fail` to always exit with code 0:
209
-
210
- ```bash
211
- mdx-linklist check ./docs --no-fail
212
- ```
213
-
214
208
  ## Development
215
209
 
216
210
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdx-linklist",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "A CLI tool to extract and validate links in MDX files",
5
5
  "author": {
6
6
  "name": "Aman Mittal",