Conversation
Move MarkBind onto Bootstrap 5.3.8 and the matching Bootswatch release so the site can use Bootstrap's native theme switching instead of custom one-off overrides. This establishes the asset baseline needed for runtime dark mode without changing page behavior yet.
Update the checked-in functional expectations after the Bootstrap upgrade and theme-aware page rendering changes. This records the new generated HTML and bundled assets so future CLI regressions are measured against the dark-mode-capable output.
Teach page generation to load both light and dark highlight themes, set the Bootstrap theme before styles paint, and apply dark-safe defaults to built-in templates. This keeps the initial render in sync with the chosen theme and avoids flashes of mismatched UI.
|
For dark mode support, the website looks cohesive and basic features are already present too. I guess a good step forward would be releasing this as an experimental feature and ask for bug reports for visual artifacts? Perhaps we can include a message along the lines of:
in the bottom banner of the page where we currently have "Website generated by MarkBind...` what do yall think? @MarkBind/active-3281-members |
While getting end users to do the testing is the trend now 😆, we should do our own testing first. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2856 +/- ##
==========================================
+ Coverage 71.28% 71.35% +0.06%
==========================================
Files 132 133 +1
Lines 7203 7229 +26
Branches 1711 1611 -100
==========================================
+ Hits 5135 5158 +23
- Misses 1967 1970 +3
Partials 101 101 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7bfd786 to
f4104c5
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces dark mode support across MarkBind-generated sites by switching to Bootstrap 5.3’s data-bs-theme mechanism, updating component/template styles to be theme-aware, and adjusting page generation + test fixtures to support runtime theme selection (including code highlighting theme assets).
Changes:
- Add runtime theme resolution (system preference +
localStorage) and setdata-bs-themeduring initial page load; load both light/dark highlight stylesheets and toggle them at runtime. - Update Vue component and core-web CSS to use Bootstrap CSS variables and add dark-mode-specific overrides.
- Refresh CLI functional expected outputs and template assets to match the new generated HTML/CSS behavior.
Reviewed changes
Copilot reviewed 145 out of 203 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vue-components/src/Tabset.vue | Add dark-mode print border override for tabset rendering. |
| packages/vue-components/src/TabGroup.vue | Add dark-mode print border override for tab groups. |
| packages/vue-components/src/Tab.vue | Add dark-mode print border override for tab headers. |
| packages/vue-components/src/Submenu.vue | Switch submenu text color to Bootstrap theme variable. |
| packages/vue-components/src/SiteNavButton.vue | Switch hamburger bar color to Bootstrap theme variable. |
| packages/vue-components/src/SiteNav.vue | Replace hardcoded nav colors with Bootstrap theme variables. |
| packages/vue-components/src/Searchbar.vue | Add dark-mode background override for .table-active rows. |
| packages/vue-components/src/panels/NestedPanel.vue | Adjust default panel background behavior and add dark-mode bg-light overrides. |
| packages/vue-components/src/panels/MinimalPanel.vue | Replace hardcoded colors with Bootstrap theme variables for dark mode. |
| packages/vue-components/src/PageNavButton.vue | Switch button dot color to Bootstrap theme variable. |
| packages/vue-components/src/Overlay.vue | Add dark-mode background for open overlay menu. |
| packages/vue-components/src/index.js | Register the new DarkModeToggle component. |
| packages/vue-components/src/cardstack/CardStack.vue | Add dark-mode text color overrides for badges/results count. |
| packages/vue-components/src/Breadcrumb.vue | Add dark-mode text color override for breadcrumb “notlink” items. |
| packages/vue-components/src/Box.vue | Add dark-mode alert overrides and align divider colors with alert border variables. |
| packages/core/test/unit/utils/data.ts | Update mocked page template assets to include both highlight stylesheets. |
| packages/core/template/project/stylesheets/main.css | Remove inline mark styling and add dark-mode template overrides. |
| packages/core/template/portfolio/stylesheets/main.css | Remove inline mark styling and add dark-mode template overrides. |
| packages/core/template/default/stylesheets/main.css | Remove inline mark styling and add dark-mode template overrides. |
| packages/core/src/Site/SitePagesManager.ts | Generate both highlight asset paths (light/dark) in page config. |
| packages/core/src/Site/LazyLiveReloadLoadingSite.html | Make loading screen colors responsive to prefers-color-scheme. |
| packages/core/src/patches/htmlparser2.ts | Treat <dark-mode-toggle> as a special tag for parsing. |
| packages/core/src/Page/PageConfig.ts | Update PageAssets to expose highlightLight/highlightDark. |
| packages/core/src/Page/page.njk | Add runtime theme resolution + dual highlight stylesheet toggling + set data-code-theme. |
| packages/core/package.json | Update Bootswatch version to match Bootstrap 5.3 series. |
| packages/core-web/src/styles/page-nav.css | Replace hardcoded nav colors with Bootstrap theme variables. |
| packages/core-web/src/styles/markbind.css | Add theme-aware mark styling and dark-mode overrides; adjust blockquote styles. |
| packages/cli/test/functional/test_site/expected/testTree.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testTooltipSpacing.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testThumbnails.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testPopoverTrigger.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testPopovers.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testPanels.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testPageNav.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testOcticonInPage.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testModals.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testMermaid.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testMath.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testMaterialIconsInPage.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testLinks.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testLayoutsOverride.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testLayouts.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testImages.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testIconsInSiteLayout.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testHr.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testGlyphiconInPage.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testFontAwesomeInPage.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testExternalScripts.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testEmptyFrontmatter.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testEmptyAltFrontMatter.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testDates.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testCodeBlocks.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/testBootstrapIconInPage.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/sub_site/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site/expected/bugs/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/userGuide/UserGuide.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/userGuide/QuickStart.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/userGuide/Features.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/userGuide/FAQ.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/team/johndoe.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/team/AboutUs.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/stylesheets/main.css | Update expected template CSS for dark-mode overrides and remove inline mark styling. |
| packages/cli/test/functional/test_site_templates/test_project/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/TracingCode.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Testing.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/SettingUp.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Requirements.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Implementation.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Documentation.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/DevOps.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/DeveloperGuide.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Design.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_project/expected/developerGuide/Configuration.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_portfolio/expected/stylesheets/main.css | Update expected template CSS for dark-mode overrides and remove inline mark styling. |
| packages/cli/test/functional/test_site_templates/test_portfolio/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_minimal/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/stylesheets/main.css | Update expected template CSS for dark-mode overrides and remove inline mark styling. |
| packages/cli/test/functional/test_site_templates/test_default/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/contents/topic3b.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/contents/topic3a.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/contents/topic2.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/contents/topic1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_templates/test_default/expected/404.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_table_plugin/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_special_tags/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/test_folder/extra_3.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/test_folder/extra_2.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/test_folder/extra_1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/README.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/Page-1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/Home.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/contents/topic3b.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/contents/topic3a.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/contents/topic2.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/contents/topic1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/about.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_navigation_convert/expected/404.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Page-1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/index.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/Home.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/contents/topic3b.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/contents/topic3a.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/contents/topic2.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/contents/topic1.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/about.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/404.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/_Sidebar.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| packages/cli/test/functional/test_site_convert/test_basic_convert/expected/_Footer.html | Update expected HTML to include theme scripts + dual highlight stylesheets + code-theme attribute script. |
| docs/njk/common.njk | Adjust docs navigation buttons styling for Bootstrap 5.3 theme compatibility. |
| docs/css/main.css | Remove inline mark styling (now handled centrally/theme-aware). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
darkmode is set to be opt in for now until mature However, if user's device is on dark mode, bootstrap will default to dark mode until javascript loads, then switch it to white mode
| (function () { | ||
| if (document.documentElement.getAttribute('data-dark-mode') !== 'true') return; | ||
|
|
||
| const STORAGE_KEY = 'markbind-theme'; |
There was a problem hiding this comment.
using a hardcoded storage key has the issue of uniqueness across sites
- Does this mean the if i toggle between light and dark mode between e.g. the
markbind.orgsite, the preference will be saved and used in thecs2103tsite?
Some alternatives to consider is
- adding a user defineable key prefix in
site.jsonfile, - generating some unique key based on some hash etc etc.
wdyt?
There was a problem hiding this comment.
ops good point i haven’t considered that.
after some research, I found out that localStorage between different domains are not shared (see MDN docs)
Conversely, would it be a feature for us to enabled saved preference across different markbind sites?
There was a problem hiding this comment.
opps, my bad, was under the wrong impression, could have been because serving it from localhost... 😅 Maybe it can be a feature but I guess it would be a bit of a stretch
There was a problem hiding this comment.
But what about that for example if u have deployments across the origin?
- E.g. markbind.org
- markbind.org/devdocs
etc.
There was a problem hiding this comment.
hmmm good point. but what are the chances we want to use different settings for different sites?
But implementation wise i think we could just append the baseUrl to the storage key
There was a problem hiding this comment.
Probably not that much, so I guess we can just leave it as it is? Appending baseUrl makes sense, up to you if you think it's important to do so!
There was a problem hiding this comment.
i think that could be a separate issue! let's have abit more discussion on this some time
|
Is the dark mode easily previewable? With the addition of |
gerteck
left a comment
There was a problem hiding this comment.
LGTM
Best thing since sliced bread, pagefind and the esm-migration ! 🎉 ~
Note:
Due to the nature of the PR, although we do not usually generate, update and commit frontend bundles markbind.min.js and markbind.min.css bundles as per devdocs
- Full build verification allows us to test
FOUClogic, asserve -dinjects styles late via JS, we cannot verify the logic without building, and also it allows us to smoke test the minification with the changes in the css assets.
In future PRs, should still follow outside of this special case to only update frontend bundles during release!
|
Resolves (Part of) #2359 |

What is the purpose of this pull request?
Overview of changes:
This is (edit: started off as) a fully vibe coded PR with (edit: has been tweaked and optimized since) minimal manual tweak to showcase what dark mode on a markbind sites can look like. The changes made include:
cssfor Vue components to support dark modesite.json. By default, the dark mode respect user'ssystem preference.
and dark mode
Anything you'd like to highlight/discuss:
Screenshots to be added later
Testing instructions:
pull this branch, run
npm run setupand serve a markbind site to see thechanges.
Proposed commit message: (wrap lines at 72 characters)
Add Dark Mode support
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major,r.Minor,r.Patch.Breaking change release note preparation (if applicable):