Bas Brands
Lead maintainer
A Moodle text filter that automatically migrates Bootstrap 4 CSS classes and data attributes to their Bootstrap 5 equivalents during HTML content rendering.
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.
data-toggle, data-target, etc.) to Bootstrap 5 format (data-bs-*)The filter translates classes across all major Bootstrap categories:
ml-* ' ms-*, mr-* ' me-*, pl-* ' ps-*, pr-* ' pe-*no-gutters ' g-0text-left/right ' text-start/endfont-weight-* ' fw-*font-italic ' fst-italiccustom-control* ' form-check*, custom-select ' form-selectbtn-block ' d-grid, close ' btn-closebadge-primary ' bg-primary, badge-pill ' rounded-pillmedia ' d-flex, media-body ' flex-grow-1 ms-3card-deck ' row row-cols-1 row-cols-md-3 g-4float-left/right ' float-start/endborder-left/right ' border-start/endrounded-left/right ' rounded-start/endsr-only ' visually-hiddenjumbotron ' bg-light p-5 rounded-3form-control-file ' form-controlinput-group-prepend/append ' input-group-textdropdown-menu-right ' dropdown-menu-endBootstrap 4 data attributes are updated to Bootstrap 5 format:
data-toggle ' data-bs-toggledata-target ' data-bs-targetdata-dismiss ' data-bs-dismissdata-slide ' data-bs-slidedata-parent ' data-bs-parentdata-spy ' data-bs-spyExtract the plugin files to your Moodle installation:
cd /path/to/moodle
cp -r bsmigrate filter/
Visit your Moodle site as an administrator to trigger the installation process
Complete the installation through the web interface