Migrate tabs to shortcode format
What does this MR do and why?
- Adds a script to migrate Tabs to shortcode format (old format vs new format)
- Fixes the shortcode for handling for images within tabs. Pages with images inside tabs were throwing errors on build.
- This was because images rendered within a shortcode have different context than images rendered at the page level.
- Adds a script to detect tabs that are nested 2+ levels deep. These are not working in Hugo (see #87). At some point we'll need to either make these work or manually refactor the content to not do this.
Screenshots, screen recordings, or links to review app
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Checkout this branch: git fetch origin 15-tabs-migration && git checkout 15-tabs-migration
-
Run this new migration alone: -
- Re-clone content, but don't run any migrations yet:
REMOVE_BEFORE_CLONE=true go run cmd/gldocs/main.go clone
- Re-clone content, but don't run any migrations yet:
-
- Run just this migration, on just the gitlab docs:
go run cmd/gldocs/main.go migrate tabs ../gitlab/doc
- Run just this migration, on just the gitlab docs:
-
- Take a look at the diff, and verify the changes look OK (no need to review the entire diff, just scroll through some of it):
git -C ../gitlab diff
- Take a look at the diff, and verify the changes look OK (no need to review the entire diff, just scroll through some of it):
-
In the diff, you should see content is transformed from the old tabs format to the new tabs format, without any other changes.
Next, test a full build:
-
Run a new clone, with the normal full migration: REMOVE_BEFORE_CLONE=true make clone-docs-projects
-
Run the local site: make view
-
Visit a few pages with Tabs. They should now render as functional tabs. Some examples:
- http://localhost:1313/user/project/merge_requests/reviews/#see-how-reviewers-map-to-approval-rules (tabs w/ images inside)
- http://localhost:1313/administration/lfs/#enable-or-disable-lfs (multiple sets of tabs on this page)
- http://localhost:1313/administration/operations/rails_console/#starting-a-rails-console-session
-
Test out the script for detecting nested tabs: ./scripts/nested-tabs.sh
(this also runs on the pipeline)
The script should find ~4 pages that have nested tabs.
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.
Closes #15 (closed)
Edited by Hiru Fernando