Configure TechDocs Locally
Working with TechDocs locally allows you to preview changes, test plugins, and troubleshoot issues before pushing your documentation to the repository.
Prerequisites
Before working with TechDocs locally, ensure you have the following installed:
1. Install MkDocs
pip install mkdocs
2. Install TechDocs Core Plugin
Install the techdocs-core plugin which includes all essential plugins:
pip install mkdocs-techdocs-core
For additional plugins, see the TechDocs Plugins Overview.
3. Install TechDocs CLI (Recommended)
The TechDocs CLI helps you build and serve documentation locally, mimicking the Harness IDP environment:
npm install -g @techdocs/cli
Local Development Workflow
Step 1: Navigate to Documentation Directory
Navigate to the directory containing your documentation files:
cd /path/to/docs
Step 2: Serve Documentation Locally
You have two options for serving documentation locally:
Option 1: Using MkDocs (Basic)
Serve your documentation using the standard MkDocs server:
mkdocs serve
Access your documentation at http://localhost:8000.
This command requires an mkdocs.yml file in your documentation directory.
Option 2: Using TechDocs CLI (Recommended)
Use the TechDocs CLI to mimic the Harness IDP build process:
techdocs-cli serve
Benefits:
- Renders documentation exactly as it appears in Harness IDP
- Automatically generates
mkdocs.ymlif not present - Better compatibility with TechDocs-specific features
Enable verbose logging for debugging:
techdocs-cli serve -v
- iFrames: Cannot be rendered locally; they only work when hosted in Harness IDP
- Auto-generated config: If no
mkdocs.ymlexists, TechDocs generates a basic configuration automatically
To customize your documentation (add plugins, modify structure, etc.), create an mkdocs.yml file in your docs directory.
Step 3: Iterate and Test
- Edit your Markdown files
- Refresh your browser to see changes in real-time
- Verify navigation, plugins, and content rendering
- Test all links and embedded media
Troubleshooting
Plugin Errors
Symptoms:
- "Plugin not found" or "Plugin not installed" errors
- Missing features or functionality
Solutions:
- Ensure all required plugins are installed:
pip install mkdocs-techdocs-core - Verify plugin compatibility with your MkDocs version
- Check that plugins are correctly listed in your
mkdocs.yml - Use
techdocs-coreinstead of individual plugins (see TechDocs Plugins)
Rendering Issues
Symptoms:
- Content not displaying correctly
- Broken formatting or layout
- Missing navigation elements
Solutions:
- Test with both
mkdocs serveandtechdocs-cli serveto identify discrepancies - Review your
mkdocs.ymlconfiguration for syntax errors - Verify all Markdown files use correct syntax
- Check that image and file paths are correct
Build Warnings and Errors
Symptoms:
- Build fails or produces warnings
- Documentation doesn't generate properly
Solutions:
Run a clean build to identify issues:
mkdocs build --clean
Review the output for specific error messages and warnings, then address them accordingly.