Skip to content

Commit 814f793

Browse files
authored
Merge pull request #152 from shotstack/derk/reference-dead-links
[1/2] fix: remove every dead link from the API reference
2 parents fecfaa0 + 117cef8 commit 814f793

10 files changed

Lines changed: 34 additions & 6 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ jobs:
8888
CODE_SAMPLES_PHP_DIR: ${{ runner.temp }}/php
8989
run: node tests/reference-code-samples.cjs
9090

91+
- name: Check reference links
92+
run: node tests/reference-links.cjs
93+
9194
- name: Dry run release
9295
env:
9396
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎api.oas3.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ components:
259259
RichTextAnimation:
260260
$ref: "./schemas/richtextproperties.yaml#/RichTextAnimation"
261261

262+
RichTextBorder:
263+
$ref: "./schemas/richtextproperties.yaml#/RichTextBorder"
264+
265+
RichTextPadding:
266+
$ref: "./schemas/richtextproperties.yaml#/RichTextPadding"
267+
262268
CaptionFont:
263269
$ref: "./schemas/captionproperties.yaml#/CaptionFont"
264270

‎build-docs.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ sed -i -e 's/\/edit\/{version}\/assets/\/serve\/{version}\/assets/g' .shins/sour
3939
sed -i -e 's/\/edit\/{version}\/sources/\/ingest\/{version}\/sources/g' .shins/source/index.html.md
4040
sed -i -e 's/\/edit\/{version}\/upload/\/ingest\/{version}\/upload/g' .shins/source/index.html.md
4141

42+
# Base URLs hold a {version} placeholder, so they are shown as code rather than as links that can't open
43+
sed -i -e 's#<a href="\(https://api\.shotstack\.io/[a-z]*/{version}\)">\1</a>#`\1`#g' .shins/source/index.html.md
44+
4245
# Build the Shins docs HTML
4346
cd .shins
4447
rm -f index.html

‎paths/assetsrenderid.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$ref: "../schemas/responses/assetrenderresponse.yaml#/AssetRenderResponse"
99
description: |
1010
A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are
11-
created the only known id is the render id returned by the original [render request](#render-video), status
11+
created the only known id is the render id returned by the original [render request](#render-asset), status
1212
request or webhook. This endpoint lets you look up one or more assets by the render id.
1313
1414
**Base URL:** <a href="#">https://api.shotstack.io/serve/{version}</a>

‎paths/render.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
**Video Preprocessing:**
2020
Video assets undergo automatic preprocessing to ensure compatibility. You can force
21-
preprocessing by setting `"transcode": true` on video assets. See [Preprocessing](#preprocessing)
21+
preprocessing by setting `"transcode": true` on video assets. See [VideoAsset](#tocs_videoasset)
2222
for more details.
2323
2424
**Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a>

‎paths/upload.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Request a signed URL to upload a file to. The response returns a signed URL that you use to upload the file to.
1111
The signed URL looks similar to:
1212
13-
https://shotstack-ingest-api-stage-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzytey4v-32km-kq1z-aftr-3kcuqi0brad2/source?AWSAccessKeyId=ASIAWJV7UWDMGTZLHTXP&Expires=1677209777&Signature=PKR4dGDDdOuMTAQmDASzLGmLOeo%3D&x-amz-acl=public-read&x-amz-security-token=IQoJb3JpZ2luX2VjEGMaDmFwLX......56osBGByztm7WZdbmXzO09KR
13+
`https://shotstack-ingest-api-stage-sources.s3.ap-southeast-2.amazonaws.com/5ca6hu7s9k/zzytey4v-32km-kq1z-aftr-3kcuqi0brad2/source?AWSAccessKeyId=ASIAWJV7UWDMGTZLHTXP&Expires=1677209777&Signature=PKR4dGDDdOuMTAQmDASzLGmLOeo%3D&x-amz-acl=public-read&x-amz-security-token=IQoJb3JpZ2luX2VjEGMaDmFwLX......56osBGByztm7WZdbmXzO09KR`
1414
1515
In a separate API call, use this signed URL to send a PUT request with the binary file. Using cURL you can use
1616
a command like:

‎schemas/destinations/akamaiNetStorageDestination.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AkamaiNetStorageDestination:
22
description: >-
3-
Send videos and assets to [Akamai NetStorage](https://techdocs.akamai.com/netstorage-usage/docs). Send files to
3+
Send videos and assets to [Akamai NetStorage](https://techdocs.akamai.com/netstorage/docs). Send files to
44
your NetStorage upload directory with a custom path and filename. Akamai credentials are required and added via the
55
[dashboard](https://dashboard.shotstack.io/integrations/akamai-netstorage), not in the request.
66
properties:

‎schemas/destinations/muxDestination.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MuxDestination:
22
description: >-
3-
Send videos to the [Mux](https://shotstack.io/docs/guide/serving-assets/destinations/mux/) video hosting
3+
Send videos to the [Mux](https://www.mux.com/docs) video hosting
44
and streaming service. Mux credentials are required and added via the
55
[dashboard](https://dashboard.shotstack.io/integrations/mux), not in the request.
66
properties:

‎schemas/edit.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
description: |
3030
**Notice: This option is now deprecated and will be removed. Disk types are handled automatically. Setting a disk type has no effect.**
3131
32-
The disk type to use for storing footage and assets for each render. See [disk types](https://shotstack.io/docs/guide/architecting-an-application/disk-types/) for more details.
32+
The disk type to use for storing footage and assets for each render.
3333
<ul>
3434
<li>`local` - optimized for high speed rendering with up to 512MB storage</li>
3535
<li>`mount` - optimized for larger file sizes and longer videos with 5GB for source footage and 512MB for output render</li>

‎tests/reference-links.cjs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const assert = require('node:assert/strict');
2+
const fs = require('node:fs');
3+
const path = require('node:path');
4+
5+
// Reads the reference produced by `pnpm build:docs`. Every in-page link must land on an element.
6+
const html = fs.readFileSync(path.resolve(__dirname, '..', 'build/docs/index.html'), 'utf8');
7+
const ids = new Set([...html.matchAll(/\sid="([^"]+)"/g)].map((match) => match[1]));
8+
const targets = [...new Set([...html.matchAll(/href="#([^"]+)"/g)].map((match) => decodeURIComponent(match[1])))];
9+
const dead = targets.filter((target) => !ids.has(target));
10+
11+
// A URL with a `{placeholder}` in it (a base URL, a path template) can't be opened, so it's shown as text.
12+
const placeholders = [...new Set([...html.matchAll(/href="(https?:\/\/[^"]*(?:[{}]|%7B|%7D)[^"]*)"/gi)].map((match) => match[1]))];
13+
14+
assert.equal(dead.length, 0, `links to missing sections: ${dead.map((target) => `#${target}`).join(', ')}`);
15+
assert.equal(placeholders.length, 0, `links to placeholder URLs: ${placeholders.join(', ')}`);
16+
console.log(`Reference links: all ${targets.length} in-page targets exist, and no link is a placeholder URL`);

0 commit comments

Comments
 (0)