Before starting, make sure you’ve installed Vale on your system.
Your First Vale Project
Create a project directory
Create a new directory for this tutorial:Create a sample Markdown file to lint:This document contains several style issues we’ll detect with Vale.
Create a Vale configuration
Create a Let’s break down this configuration:
.vale.ini file in your project root:StylesPath: Where Vale looks for style packages (relative to.vale.ini)MinAlertLevel: Minimum severity to display (suggestion,warning, orerror)Packages: External style packages to download[*.md]: Apply these settings to all Markdown filesBasedOnStyles: Which styles to use (Vale’s built-in style + Microsoft’s style guide)
Download style packages
Vale can automatically download style packages from the Package Hub:You should see output like:This creates a
styles directory and downloads the Microsoft style guide rules.Understanding the Output
Vale’s default output format is designed for humans. Let’s look at each part:3:41: Line 3, column 41 in the filewarning: Severity level (can beerror,warning, orsuggestion)Try to avoid using 'utilize': The alert messageVale.Avoid: The rule that triggered (from theValestyle, rule namedAvoid)
Exploring Configuration Options
Let’s enhance our configuration to demonstrate Vale’s flexibility:.vale.ini
Configuration breakdown
Configuration breakdown
Packages: Download both Microsoft and Google style guidesVocab: Use custom vocabulary fromstyles/config/vocabularies/MyCompany/[*.md]: Default rules for all Markdown files[blog/*.md]: Override settings for blog posts (only show errors)[api-docs/*.md]: Disable linting for auto-generated API docs
Vale supports glob patterns in section headers, letting you apply different rules to different parts of your project. More specific patterns override general ones.
Working with Styles
Vale’s power comes from its extensible style system. You have three options:- Pre-built Packages
- Create Your Own
- Mix and Match
Download styles from the Package Hub:Popular packages:Then run:
- Microsoft: Microsoft Writing Style Guide
- Google: Google Developer Documentation Style Guide
- Readability: Readability metrics and suggestions
- proselint: General writing advice
- write-good: Plain English suggestions
.vale.ini:Understanding Severity Levels
Vale rules have three severity levels:suggestion
Optional improvements. Doesn’t fail CI builds.
warning
Recommended changes. May fail CI depending on configuration.
error
Must be fixed. Fails CI builds by default.
.vale.ini
By default, Vale exits with code 1 if any errors are found. Use
--no-exit to suppress this behavior for CI systems that handle exit codes differently.Common Vale Commands
Real-World Example
Here’s a production-ready configuration for a technical documentation project:.vale.ini
- Uses multiple style guides for different content types
- Enforces stricter rules on API docs
- Relaxes rules for blog posts
- Ignores dependency directories
- Uses custom vocabulary for company terms
Next Steps
You now have Vale running! Here’s what to explore next:Configuration Deep Dive
Learn about all
.vale.ini options, glob patterns, and inheritance.Understanding Styles
How Vale’s style system works and how to create custom rules.
Writing Rules
Create your first custom Vale rule with detailed examples.
CI/CD Integration
Add Vale to GitHub Actions, GitLab CI, CircleCI, and more.
Scoping Rules
Control exactly where rules apply in your documents.
Custom Vocabularies
Manage accepted and rejected terminology.
Tips and Tricks
Use vale with stdin
Use vale with stdin
Vale can read from standard input, useful for integrating with other tools:
Use
--ext to specify the file extension when reading from stdin. This helps Vale determine the correct parser to use.Ignore specific lines
Ignore specific lines
Disable Vale for specific lines using comments:Or disable specific rules:
Lint multiple formats
Lint multiple formats
Vale automatically detects file formats:Each format has intelligent parsing to avoid false positives in code blocks and other non-prose content.
Speed up linting with filters
Speed up linting with filters
Use Or use
.vale.ini to skip directories:.gitignore patterns - Vale respects them by default.Troubleshooting
No style found
No style found
Error:
The path 'styles' does not existSolution: Run vale sync to download style packages, or create the styles directory:Config not found
Config not found
Error:
Unable to locate a configuration fileSolution: Vale searches for .vale.ini in the current directory and parent directories. Either:- Create
.vale.iniin your project root - Create a global config at
~/.vale.ini - Use
--configto specify a path:vale --config=/path/to/.vale.ini docs/
Rules not applying
Rules not applying
Problem: Vale isn’t finding issues you expectDebug steps:
-
Check which config Vale is using:
-
Verify the file matches your glob pattern:
-
Check rule severity vs.
MinAlertLevel: