Documentation Local Setup
How to set up and run Jekyll locally for testing documentation changes.
Table of contents
- Overview
- Prerequisites
- Initial Setup
- Running Jekyll Locally
- Common Options
- Testing Checklist
- Troubleshooting
- Error: “cannot load such file – kramdown-parser-gfm”
- Error: “cannot load such file – jekyll-include-cache”
- Error: “Permission denied” during bundle install
- Error: “cannot load such file – webrick”
- Port 4000 Already in Use
- Mermaid Diagrams Not Rendering
- Styles Not Loading (No Theme)
- Changes Not Appearing
- Build Errors
- Project Structure
- Jekyll Configuration
- Deployment
- Tips for Documentation Authors
- Further Reading
- Quick Reference
Overview
MSR documentation uses Jekyll with the Just the Docs theme and is automatically deployed to GitHub Pages. Before pushing documentation changes, you can test them locally to verify formatting, links, and layout.
Documentation URL:
- Production: https://migration-script-runner.github.io/msr-core
- Custom domain: https://core.msr.lavr.site
Prerequisites
Ruby Installation
Jekyll requires Ruby. macOS comes with system Ruby, but it’s recommended to use a version manager to avoid permission issues.
Using rbenv (Recommended)
Install rbenv:
# Using Homebrew
brew install rbenv ruby-build
# Initialize rbenv
rbenv init
Add to your shell profile (~/.zshrc or ~/.bash_profile):
eval "$(rbenv init - zsh)"
Restart your terminal, then install Ruby:
# Install Ruby 3.1.0 (or latest stable)
rbenv install 3.1.0
# Set as local version for this project
cd /path/to/msr
rbenv local 3.1.0
# Verify
ruby -v # Should show: ruby 3.1.0
Alternative: Using System Ruby
If you prefer system Ruby, you’ll need sudo access for gem installations:
ruby -v # Check version (should be 2.6+)
Initial Setup
1. Install Bundler
gem install bundler
If using system Ruby and you get permission errors:
sudo gem install bundler
2. Install Dependencies
Option 1 - Using npm (Recommended):
npm run docs:install
Option 2 - Using bundler directly:
Navigate to the docs folder:
cd /path/to/msr/docs
Install Jekyll and all dependencies:
bundle install
If using system Ruby and you encounter permission errors:
# Install gems to local vendor directory instead
bundle install --path vendor/bundle
This will install:
- Jekyll (~3.9.0)
- Just the Docs theme (0.4.0)
- kramdown-parser-gfm (GitHub Flavored Markdown)
- jekyll-seo-tag (SEO optimization)
- jekyll-sitemap (automatic sitemap.xml generation)
- jekyll-remote-theme (remote theme support)
- jekyll-include-cache (theme performance)
- webrick (Ruby 3.0+ compatibility)
First-time setup takes 2-3 minutes to download and compile all gems.
Running Jekyll Locally
Start the Development Server
Option 1 - Using npm (Recommended):
npm run docs:serve
Option 2 - Using bundler directly:
cd docs
bundle exec jekyll serve
Output:
Configuration file: /path/to/msr/docs/_config.yml
Source: /path/to/msr/docs
Destination: /path/to/msr/docs/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 2.341 seconds.
Auto-regeneration: enabled for '/path/to/msr/docs'
Server address: http://127.0.0.1:4000
Server running... press ctrl-c to stop.
Access the Documentation
Open your browser to: http://localhost:4000
Key pages to check:
- Homepage: http://localhost:4000
- Origin Story: http://localhost:4000/about/origin-story
- Philosophy: http://localhost:4000/about/philosophy
- API Docs: http://localhost:4000/api
Live Reload
Jekyll watches for file changes and automatically rebuilds:
- Edit a documentation file
- Save the file
- Refresh your browser (usually takes 1-2 seconds to rebuild)
Note: Changes to _config.yml require restarting the server.
Common Options
Run on Different Port
bundle exec jekyll serve --port 4001
Enable Incremental Builds (Faster)
bundle exec jekyll serve --incremental
Warning: Incremental builds are faster but may miss some changes. Do a full rebuild if something looks wrong.
Show Drafts
bundle exec jekyll serve --drafts
Verbose Output (Debugging)
bundle exec jekyll serve --verbose
Testing Checklist
When testing documentation changes locally, verify:
Navigation:
- Page appears in correct sidebar section
nav_orderis correct- Parent/child relationships work
- Breadcrumbs display correctly
Content:
- All headings render correctly
- Table of contents generates properly
- Code blocks have syntax highlighting
- Links work (internal and external)
- Images display (if any)
Formatting:
- Callout boxes render (note, warning, tip)
- Tables are formatted correctly
- Lists render properly (ordered, unordered, nested)
- Bold/italic/code formatting works
Mermaid Diagrams:
- Diagrams render without errors
- Diagram is readable and properly sized
- Colors and styling work
Search:
- New content is searchable
- Search results link to correct pages
Mobile:
- Resize browser to mobile width
- Navigation menu works
- Content is readable
Troubleshooting
Error: “cannot load such file – kramdown-parser-gfm”
Solution: Add to Gemfile:
gem "kramdown-parser-gfm"
Then run:
bundle install
Error: “cannot load such file – jekyll-include-cache”
Solution: The Just the Docs theme requires this plugin.
Add to Gemfile:
group :jekyll_plugins do
gem "jekyll-include-cache"
end
Add to _config.yml:
plugins:
- jekyll-include-cache
Then run:
bundle install
Error: “Permission denied” during bundle install
Solution 1 - Use rbenv (recommended):
brew install rbenv ruby-build
rbenv install 3.1.0
rbenv local 3.1.0
bundle install
Solution 2 - Install to local path:
bundle install --path vendor/bundle
Error: “cannot load such file – webrick”
Solution: Add to Gemfile:
gem "webrick"
This is required for Ruby 3.0+.
Port 4000 Already in Use
Solution: Use a different port:
bundle exec jekyll serve --port 4001
Or find and kill the process using port 4000:
lsof -ti:4000 | xargs kill -9
Mermaid Diagrams Not Rendering
Check: Mermaid version in _config.yml:
mermaid:
version: "9.1.3"
MSR uses Mermaid 9.1.3 with specific syntax requirements. See Documentation Writing Standards.
Styles Not Loading (No Theme)
Symptom: Site runs but has no styling, looks like plain HTML.
Solution: Install the jekyll-remote-theme plugin.
Add to Gemfile:
group :jekyll_plugins do
gem "jekyll-seo-tag"
gem "jekyll-remote-theme"
end
Add to _config.yml:
plugins:
- jekyll-seo-tag
- jekyll-remote-theme
Then run:
bundle install
bundle exec jekyll serve
Changes Not Appearing
Solutions:
- Hard refresh browser:
Cmd+Shift+R(Mac) orCtrl+Shift+R(Windows) - Clear Jekyll cache:
rm -rf _site .jekyll-cache - Restart Jekyll server
- Check for syntax errors in frontmatter
Build Errors
Check common issues:
- YAML frontmatter syntax
- Unclosed code blocks (missing closing backticks)
- Invalid Markdown syntax
- Missing required frontmatter fields
Project Structure
docs/
├── _config.yml # Jekyll configuration
├── Gemfile # Ruby dependencies
├── Gemfile.lock # Locked dependency versions
├── CNAME # Custom domain configuration
├── index.md # Homepage
├── getting-started.md # Quick start guide
├── api/ # API reference docs
├── guides/ # User guides
├── development/ # Contributor docs
├── about/ # Origin story & philosophy
├── assets/
│ └── css/
│ └── custom.css # Custom styling
└── _site/ # Generated site (gitignored)
Jekyll Configuration
Key settings in _config.yml:
# Theme
remote_theme: just-the-docs/just-the-docs
# URLs
url: "https://core.msr.lavr.site"
baseurl: ""
# Mermaid diagrams
mermaid:
version: "9.1.3"
# Search
search_enabled: true
# Code copy button
enable_copy_code_button: true
Deployment
How GitHub Pages Deploys
- Changes pushed to
masterbranch - GitHub Pages detects changes in
/docsfolder - Jekyll build runs automatically on GitHub servers
- Site deploys in 1-2 minutes
No manual deployment needed - GitHub handles everything.
Verify Deployment
After pushing to master:
- Go to Repository → Settings → Pages
- Check “Your site is live at…” message
- Or check Actions tab for “pages build and deployment” workflow
- Visit the live URL to verify changes
Build Status
Check if GitHub Pages build succeeded:
- Repository → Actions tab
- Look for “pages build and deployment”
- Green checkmark = success
- Red X = build failed (check error logs)
Tips for Documentation Authors
Before Committing
- Test locally first: Always run Jekyll locally before committing
- Check all links: Verify internal links work
- Test search: Make sure new content is searchable
- Review mobile: Check responsive layout
- Validate Mermaid: Ensure diagrams render correctly
Writing Style
- Follow Documentation Writing Standards
- Use consistent terminology
- Keep sentences concise
- Add code examples
- Include links to related pages
Mermaid Best Practices
- Keep diagrams simple (5-10 nodes max)
- Use Mermaid 9.1.3 compatible syntax
- No emojis, no dots in labels, no special characters
- Add caption below diagram
- Test rendering locally
Further Reading
- Documentation Writing Standards - Style guide and standards
- Contributing Guide - How to contribute to MSR
- Jekyll Documentation - Official Jekyll docs
- Just the Docs Theme - Theme documentation
Quick Reference
Using npm scripts (Recommended)
# Install dependencies
npm run docs:install
# Start server
npm run docs:serve
# Build site (without serving)
npm run docs:build
Using bundler directly
# Install dependencies
cd docs && bundle install
# Start server
cd docs && bundle exec jekyll serve
# Start on different port
cd docs && bundle exec jekyll serve --port 4001
# Start with incremental builds
cd docs && bundle exec jekyll serve --incremental
# Clean generated files
cd docs && rm -rf _site .jekyll-cache
# Update dependencies
cd docs && bundle update
Local URL: http://localhost:4000
Production URL: https://migration-script-runner.github.io/msr-core