Skip to content

Commit 591dc00

Browse files
Copilothotlong
andcommitted
Address code review feedback
- Make fix-links.sh portable with relative paths - Add comment about reference-style link support - Clarify no dependencies needed in GitHub Actions workflow Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 31f1d23 commit 591dc00

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/validate-docs-links.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
with:
3232
node-version: '20.x'
3333

34+
# Note: The validation script uses only Node.js built-in modules
35+
# (fs, path, url) and requires no external dependencies
36+
3437
- name: Validate documentation links
3538
id: validate
3639
run: |

scripts/fix-links.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
set -e
55

6-
DOCS_DIR="/home/runner/work/objectui/objectui/docs"
6+
# Get the directory where the script is located
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
DOCS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)/docs"
79

8-
echo "Fixing broken documentation links..."
10+
echo "Fixing broken documentation links in: $DOCS_DIR"
911

1012
# Fix /docs/ prefix (fumadocs baseUrl is already /docs, so links should not include it)
1113
find "$DOCS_DIR" -type f \( -name "*.md" -o -name "*.mdx" \) -exec sed -i 's|](/docs/plugins/|](/plugins/|g' {} +

scripts/validate-docs-links.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,22 @@ function scanDirectory(dir, baseRoute = '') {
6363
function extractLinks(content, filePath) {
6464
const links = [];
6565

66-
// Match markdown links: [text](url)
67-
const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
66+
// Match markdown inline links: [text](url)
67+
const inlineLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
6868
let match;
6969

70-
while ((match = linkRegex.exec(content)) !== null) {
70+
while ((match = inlineLinkRegex.exec(content)) !== null) {
7171
const text = match[1];
7272
const url = match[2];
7373
const line = content.substring(0, match.index).split('\n').length;
7474

7575
links.push({ text, url, line, filePath });
7676
}
7777

78+
// Note: Reference-style links ([text][ref]) are not commonly used in this codebase
79+
// and are typically resolved at build time by the documentation framework.
80+
// If needed in the future, add support here.
81+
7882
return links;
7983
}
8084

0 commit comments

Comments
 (0)