A tool to maintain consistency and quality in Slidev presentations.
The Slidev Linter was designed to solve several common issues when creating and maintaining Slidev presentations:
- Format Consistency - Ensure a uniform visual presentation across all files
- Task Automation - Avoid having to manually make repetitive formatting corrections
- Transition Standardization - Apply consistent logic for transitions between slides
- Readability Enhancement - Ensure appropriate spacing between elements for better reading
The linter works on the principle of "rules" that can be applied individually or in predefined sets. Each rule targets a specific aspect of formatting and can be enabled or disabled as needed.
- ๐ Automatic correction of formatting issues
- ๐ฌ Intelligent management of transitions between slides
- ๐ Optimal spacing between titles, subtitles, and tables
- ๐ค Removal of bold formatting from titles (which is redundant in Slidev)
- ๐ Flexible selection of files to process via glob patterns
- Place the
slidev_linter.pyfile at the root of your Slidev project - Make sure Python 3.6+ is installed on your system
- No external dependencies required
You can install the linter directly from Th3Mouk's GitHub repository:
# Download the slidev_linter.py file
curl -o slidev_linter.py https://raw.githubusercontent.com/Th3Mouk/slidev-linter/main/slidev_linter.py
# Make the file executable (optional)
chmod +x slidev_linter.pyTo integrate it into an existing project:
# In your Slidev project
cd your-slidev-project
# Download the linter
curl -o slidev_linter.py https://raw.githubusercontent.com/Th3Mouk/slidev-linter/main/slidev_linter.py
# Test the installation
python3 slidev_linter.py --list-rulesAdd these scripts to your package.json for easy integration:
"scripts": {
"lint:slides": "python slidev_linter.py --all",
"lint:fix": "python slidev_linter.py --all --rule-set advanced_formatting"
}# Process all files
python slidev_linter.py --all
# Process a specific file
python slidev_linter.py --file 20-continuous-delivery.md
# Process files matching a glob pattern
python slidev_linter.py --pattern "2[0-9]-*.md"
python slidev_linter.py --pattern "gitlab-*.md"
# List available rules
python slidev_linter.py --list-rules
# List available rule sets
python slidev_linter.py --list-rule-sets# Apply a predefined rule set
python slidev_linter.py --all --rule-set basic_formatting
python slidev_linter.py --all --rule-set advanced_formatting
# Apply specific rules
python slidev_linter.py --all --rules remove_bold_from_titles add_spacing_after_titlesThe linter includes several rules that can be applied individually or in sets:
remove_bold_from_titles- Removes bold formatting from titles (# Title โ # Title)
default_transition- Ensures the default transition in the header is 'slide-left'section_transition- Adds 'transition: slide-left' only for slides with 'section' layoutclean_transitions- Cleans up duplicate or misplaced transitions
ensure_space_between_title_subtitle- Ensures there is a blank line between a title and its subtitleadd_spacing_after_titles- Adds an HTML spacing tag after level 1 titles, except before tables or subtitles
basic_formatting- Basic rules for consistent formattingadvanced_formatting- All rules for optimal and complete formatting
python slidev_linter.py --all --rule-set advanced_formattingpython slidev_linter.py --pattern "2[0-9]-*.md" --rules default_transition section_transition clean_transitionspython slidev_linter.py --file 30-continuous-delivery.md --rules add_spacing_after_titlesThe linter is designed to be easily extensible. You can add your own rules by creating new classes that inherit from the Rule class and implementing the apply() method.
Contributions are welcome! Feel free to propose new rules or improvements to existing rules.