Skip to content

Commit 79d7e72

Browse files
docs: update documentation slugs (#150)
1 parent 349fe52 commit 79d7e72

File tree

229 files changed

+1526
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+1526
-650
lines changed

.github/workflows/nodejs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,17 @@ jobs:
1616
node-version-matrix: '[24]'
1717
upload-coverage: false
1818
disable-test-package: true
19+
20+
check-filenames:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '24'
30+
31+
- name: Run filenames check
32+
run: node checkFilenames.mjs

blog/releases/1.0.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ The new `blackRois` and `whiteRois` properties provide more intuitive access to
149149

150150
For more information, please visit these tutorials:
151151

152-
- [Image segmentation with `threshold()` and `fromMask()`](../../docs/Tutorials/Image%20segmentation%20with%20threshold)
153-
- [Image segmentation with `watershed()`](../../docs/Tutorials/Image%20segmentation%20with%20watershed)
152+
- [Image segmentation with `threshold()` and `fromMask()`](../../docs/tutorials/image-segmentation-with-threshold)
153+
- [Image segmentation with `watershed()`](../../docs/tutorials/image-segmentation-with-watershed)
154154

155155
### Sobel and Scharr filters
156156

@@ -266,7 +266,7 @@ The following deprecated features have been removed:
266266

267267
- `countAlphaPixel()` - Use custom pixel counting with [`getPixel()`](https://api.image-js.org/classes/index.Image.html#getpixel 'API link on getPixel').
268268
- `paintLabels()` and `roi.paint()` - Features have been removed due to dependency issues. We plan to add it back in future updates.
269-
- `warpingFourPoints()` - Use [`getPerspectiveWarpMatrix()`](../../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on getPerspectiveWarp') + [`transform()`](#transform) instead.
269+
- `warpingFourPoints()` - Use [`getPerspectiveWarpMatrix()`](../../docs/features/geometry/get-perspective-warp-matrix 'internal link on getPerspectiveWarp') + [`transform()`](#transform) instead.
270270
- 32-bit color depth support and `abs()` have been removed.
271271
- `CMYK` and `HSL` color models have been removed.
272272
- `paintMasks()` has been removed. Use [`paintMask()`](https://api.image-js.org/classes/index.Image.html#paintmask 'API link on paintMask')+ a `for` loop.
@@ -303,7 +303,7 @@ const matrix = getPerspectiveWarp(sourcePoints);
303303
const warped = img.transform(matrix);
304304
```
305305

306-
For more details, [visit our tutorial](../../docs/Tutorials/Applying%20transform%20function%20on%20images 'internal link on transform function tutorial') on how image transformations work how they can be used.
306+
For more details, [visit our tutorial](../../docs/tutorials/applying-transform-function-on-images 'internal link on transform function tutorial') on how image transformations work how they can be used.
307307

308308
### Bicubic interpolation
309309

@@ -323,11 +323,11 @@ const resized = img.resize(800, 600, { interpolation: 'bicubic' });
323323
const prewitt = img.derivative({ filter: 'prewitt' });
324324
```
325325

326-
**Use cases**: Object detection, image segmentation, feature extraction. You can [learn more about it here](../../docs/Features/Morphology/Morphological%20Gradient 'internal link on morphological gradient').
326+
**Use cases**: Object detection, image segmentation, feature extraction. You can [learn more about it here](../../docs/features/morphology/morphological-gradient 'internal link on morphological gradient').
327327

328328
### Migration from deprecated methods
329329

330-
`warpingFourPoints()` has been removed. Now you have [`getPerspectiveWarp()`](../../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on perspective warp') that returns a matrix that can be applied on the image of interest in a new `transform()`.
330+
`warpingFourPoints()` has been removed. Now you have [`getPerspectiveWarp()`](../../docs/features/geometry/get-perspective-warp-matrix 'internal link on perspective warp') that returns a matrix that can be applied on the image of interest in a new `transform()`.
331331

332332
```ts
333333
// Before
@@ -338,7 +338,7 @@ const matrix = getPerspectiveWarp(corners);
338338
const warped = img.transform(matrix);
339339
```
340340

341-
**Use cases**: Rectification of a perspective angle of an image. You can learn more about it [here](../../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix 'internal link on perspective warp').
341+
**Use cases**: Rectification of a perspective angle of an image. You can learn more about it [here](../../docs/features/geometry/get-perspective-warp-matrix 'internal link on perspective warp').
342342

343343
### `merge()`
344344

checkFilenames.mjs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import fs from 'fs';
2+
import path from 'path';
3+
4+
const __dirname = import.meta.dirname;
5+
6+
function getAllFiles(dirPath) {
7+
let incorrectFormatFiles = [];
8+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
9+
10+
const filenameFormat = /^[a-z0-9]+(?:[-.][a-z0-9]+)*$/;
11+
12+
for (const entry of entries) {
13+
// Skip certain files/folders
14+
if (
15+
entry.name === '.DS_Store' ||
16+
entry.name === 'images' ||
17+
entry.name === 'demos' ||
18+
entry.name === '_category_.json'
19+
) {
20+
continue;
21+
}
22+
23+
// Get the name without extension for files, or full name for directories
24+
const nameToTest = entry.isFile()
25+
? path.parse(entry.name).name
26+
: entry.name;
27+
28+
if (!filenameFormat.test(nameToTest)) {
29+
incorrectFormatFiles.push(path.join(dirPath, entry.name));
30+
}
31+
32+
// Recursively check subdirectories
33+
if (entry.isDirectory()) {
34+
const subDirResults = getAllFiles(path.join(dirPath, entry.name));
35+
incorrectFormatFiles = incorrectFormatFiles.concat(subDirResults);
36+
}
37+
}
38+
39+
return incorrectFormatFiles;
40+
}
41+
42+
const folders = ['docs', 'blog'];
43+
44+
for (const folder of folders) {
45+
const folderPath = path.join(__dirname, folder);
46+
const incorrectFormatFiles = getAllFiles(folderPath);
47+
if (incorrectFormatFiles.length !== 0) {
48+
throw new Error(
49+
`Files with incorrect filename format found:\n${incorrectFormatFiles.join('\n')}`,
50+
);
51+
}
52+
}
53+
console.log('All files have passed the check.');

docs/Features/Comparison/Comparison.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/Features/Filters/Filters.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/Features/Geometry/Geometry.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/Features/Morphology/Morphology.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/Features/Operations/Operations.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/Features/Regions of interest/Regions of interest.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/Tutorials/_category_.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)