1+ name : MDX Validation
2+
3+ on :
4+ pull_request :
5+ branches : [ main ]
6+ paths :
7+ - ' docs/**'
8+ - ' .github/workflows/**'
9+
10+ jobs :
11+ validate-mdx :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout repo
15+ uses : actions/checkout@v4
16+
17+ - name : Setup Node.js
18+ uses : actions/setup-node@v4
19+ with :
20+ node-version : ' 18'
21+ cache : ' npm'
22+
23+ - name : MDX validation dependencies
24+ run : npm install --save-dev @mdx-js/mdx @mdx-js/loader
25+
26+ - name : Validate MDX files
27+ run : |
28+ # Find and validate all MDX files in the docs directory
29+ find docs -name "*.mdx" -type f | while read file; do
30+ echo "Validating: $file"
31+ node -e "
32+ const fs = require('fs');
33+ const { compile } = require('@mdx-js/mdx');
34+
35+ try {
36+ const content = fs.readFileSync('$file', 'utf8');
37+ compile(content, { jsx: true });
38+ console.log('✅ $file - Valid MDX');
39+ } catch (error) {
40+ console.error('❌ $file - MDX Error:', error.message);
41+ process.exit(1);
42+ }
43+ "
44+ done
45+
46+ - name : Check for broken links
47+ run : |
48+ # Simple check for common broken link patterns
49+ echo "Checking for potential broken links..."
50+ if grep -r "http://localhost\|http://127.0.0.1" docs/; then
51+ echo "❌ Found localhost links that should be removed"
52+ exit 1
53+ fi
54+ echo "✅ No obvious broken links found"
55+
56+ - name : Validate frontmatter
57+ run : |
58+ # Check that all MDX files have required frontmatter
59+ find docs -name "*.mdx" -type f | while read file; do
60+ if ! head -n 10 "$file" | grep -q "^---$"; then
61+ echo "❌ $file - Missing frontmatter (no --- markers)"
62+ exit 1
63+ fi
64+ echo "✅ $file - Has frontmatter"
65+ done
0 commit comments