---
title: stx check
description: Validate your documentation configuration, content, and links.
icon: check
---

# stx check

Validate your documentation project for errors before building or deploying. Catches configuration issues, broken links, invalid MDX, and more.

## Usage

```bash
stx check [options]
```

## Options

| Flag | Alias | Type | Default | Description |
|------|-------|------|---------|-------------|
| `--fix` | `-f` | boolean | `false` | Auto-fix fixable issues |
| `--strict` | | boolean | `false` | Treat warnings as errors |
| `--links` | | boolean | `true` | Check internal links |
| `--external` | | boolean | `false` | Check external links |
| `--spelling` | | boolean | `false` | Check spelling |

## Examples

### Basic Validation

```bash
stx check
```

### Auto-Fix Issues

```bash
stx check --fix
```

Automatically fixes:
- Frontmatter formatting
- Navigation order
- Image path casing

### Strict Mode (CI)

```bash
stx check --strict
```

Fails on any warning, useful for CI pipelines.

### Include External Links

```bash
stx check --external
```

Verifies that external URLs return 200 OK.

## Validation Output

```
stx check

Checking documentation...

Configuration
  ✓ syntext.json valid
  ✓ Navigation structure valid

Content (47 files)
  ✓ All MDX files valid
  ✓ All frontmatter valid

Links
  ⚠ docs/guides/auth.mdx:42 - Link to "/api/tokens" not found
  ✓ 156 internal links checked

Images
  ✓ 23 images found and accessible

Summary
  Errors: 0
  Warnings: 1

Run `stx check --fix` to auto-fix issues.
```

## Checks Performed

### Configuration

| Check | Description |
|-------|-------------|
| Config syntax | Valid JSON/YAML syntax |
| Required fields | `name` and `navigation` present |
| Navigation references | All pages in navigation exist |
| Color values | Valid hex colors |

### Content

| Check | Description |
|-------|-------------|
| MDX syntax | Valid MDX/JSX syntax |
| Frontmatter | Required `title` field present |
| Component usage | Components have required props |
| Code blocks | Valid language identifiers |

### Links

| Check | Description |
|-------|-------------|
| Internal links | Linked pages exist |
| Anchor links | Headings exist on target page |
| Image references | Image files exist |
| External links | URLs return 200 (with `--external`) |

### Assets

| Check | Description |
|-------|-------------|
| Images | Files exist in `public/` |
| Favicons | Favicon files referenced in config exist |
| Logos | Logo files referenced in config exist |

## Auto-Fix Capabilities

With `--fix`, these issues are automatically corrected:

```
✓ Fixed: docs/guide.mdx - Normalized frontmatter indentation
✓ Fixed: syntext.json - Sorted navigation alphabetically
✓ Fixed: docs/api.mdx - Corrected image path casing
```

## CI Integration

Add to your CI pipeline to catch issues before merge:

### GitHub Actions

```yaml
- name: Validate docs
  run: stx check --strict
```

### Pre-commit Hook

```bash
# .husky/pre-commit
stx check --strict
```

## Exit Codes

| Code | Meaning |
|------|---------|
| `0` | No errors |
| `1` | Errors found |
| `2` | Configuration invalid |

## Common Issues

### Missing Navigation Entry

```
⚠ docs/new-page.mdx not in navigation
```

**Fix:** Add the page to `navigation` in `syntext.json`:

```json
{
  "navigation": [
    {
      "group": "Guides",
      "pages": ["guides/new-page"]
    }
  ]
}
```

### Broken Internal Link

```
✗ docs/getting-started.mdx:15 - Link to "/setup" not found
```

**Fix:** Update the link to an existing page or create the missing page.

### Invalid Component Props

```
✗ docs/api.mdx:42 - <ParamField> missing required "name" prop
```

**Fix:** Add the missing prop:

```mdx
<ParamField name="email" type="string">
  User email address.
</ParamField>
```
