
Bsmigrate
- Moodle 4.5–5.0
- 更新 2025-12-22
A Moodle text filter that automatically migrates Bootstrap 4 CSS classes and data attributes to their Bootstrap 5 equivalents during HTML content rendering.
Bootstrap Migration Filter (bsmigrate)
A Moodle text filter that automatically migrates Bootstrap 4 CSS classes and data attributes to their Bootstrap 5 equivalents during HTML content rendering.
Purpose
This filter addresses the challenge of migrating from Bootstrap 4 to Bootstrap 5 by automatically translating deprecated Bootstrap 4 classes and data attributes to their Bootstrap 5 counterparts. It processes HTML content in real-time, making it invaluable during the transition period when content may contain a mix of Bootstrap 4 and Bootstrap 5 syntax.
Features
Comprehensive Class Translation : Translates 130+ Bootstrap 4 classes to Bootstrap 5 equivalents
Data Attribute Processing : Updates Bootstrap 4 data attributes ( data-toggle , data-target , etc.) to Bootstrap 5 format ( data-bs-* )
Case-Insensitive Processing : Handles class names regardless of case
Duplicate Class Handling : Automatically deduplicates classes after translation
Performance Optimized : Skips processing when no Bootstrap classes are detected
Comprehensive Coverage : Includes all major Bootstrap components and utility classes
Scope
CSS Classes Covered
The filter translates classes across all major Bootstrap categories:
Layout & Spacing
Margin/Padding : ml-* → ms-* , mr-* → me-* , pl-* → ps-* , pr-* → pe-*
Responsive Spacing : All breakpoints (sm, md, lg, xl, xxl) with auto margins
Grid System : no-gutters → g-0
Typography & Alignment
- 1.0Moodle 4.5, 5.0