From 802e17d28add6ec03f5a77f0baf6c10e262795e9 Mon Sep 17 00:00:00 2001 From: Dima Demakov Date: Fri, 24 Nov 2023 14:33:24 +0100 Subject: [PATCH 1/3] doc: make theme consistent across api and other docs Since website based on 2 different repos, there was an inconsistency in theme selection, so we had 2 independant theme props. Now only one stored in local storage is a single source of truth --- BUILDING.md | 7 +++++++ doc/api_assets/api.js | 14 +++++++------- doc/contributing/collaborator-guide.md | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 46827af7c40cbf..0453963b592ebc 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -462,6 +462,13 @@ make docopen This will open a file URL to a one-page version of all the browsable HTML documents using the default browser. + +```bash +make docclean +``` + +This will clean previously built doc. + To test if Node.js was built correctly: ```bash diff --git a/doc/api_assets/api.js b/doc/api_assets/api.js index c7568206e29f19..8b40042f85cbae 100644 --- a/doc/api_assets/api.js +++ b/doc/api_assets/api.js @@ -2,11 +2,11 @@ { function setupTheme() { - const kCustomPreference = 'customDarkTheme'; - const userSettings = sessionStorage.getItem(kCustomPreference); + const storedTheme = localStorage.getItem('theme'); const themeToggleButton = document.getElementById('theme-toggle-btn'); - if (userSettings === null && window.matchMedia) { + // Follow operating system theme preference + if (storedTheme === null && window.matchMedia) { const mq = window.matchMedia('(prefers-color-scheme: dark)'); if ('onchange' in mq) { @@ -28,16 +28,16 @@ if (mq.matches) { document.documentElement.classList.add('dark-mode'); } - } else if (userSettings === 'true') { + } else if (storedTheme === 'dark') { document.documentElement.classList.add('dark-mode'); } if (themeToggleButton) { themeToggleButton.hidden = false; themeToggleButton.addEventListener('click', function() { - sessionStorage.setItem( - kCustomPreference, - document.documentElement.classList.toggle('dark-mode'), + localStorage.setItem( + 'theme', + document.documentElement.classList.toggle('dark-mode') ? 'dark' : 'light', ); }); } diff --git a/doc/contributing/collaborator-guide.md b/doc/contributing/collaborator-guide.md index 2ecf14a082dc3b..db875173e26c54 100644 --- a/doc/contributing/collaborator-guide.md +++ b/doc/contributing/collaborator-guide.md @@ -532,7 +532,7 @@ The TSC serves as the final arbiter where required. [build](https://github.com/nodejs/build/issues) repositories, open new issues. Run a new CI any time someone pushes new code to the pull request. 4. Check that the commit message adheres to [commit message guidelines][]. -5. Add all necessary [metadata](#metadata) to commit messages before landing. If +5. Add all necessary [metadata](git-node-metadata) to commit messages before landing. If you are unsure exactly how to format the commit messages, use the commit log as a reference. See [this commit][commit-example] as an example. From 7f5acabce1d1845cf1c0b2dfe9a7c3212cecbdb9 Mon Sep 17 00:00:00 2001 From: Dima Demakov Date: Fri, 24 Nov 2023 16:52:00 +0100 Subject: [PATCH 2/3] doc: update formatting --- BUILDING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 0453963b592ebc..4249f45abbfe06 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -462,12 +462,11 @@ make docopen This will open a file URL to a one-page version of all the browsable HTML documents using the default browser. - ```bash make docclean ``` -This will clean previously built doc. +This will clean previously built doc. To test if Node.js was built correctly: From 56045316fd35370b8810d9c038d995e31559f6a6 Mon Sep 17 00:00:00 2001 From: Dima Demakov Date: Sun, 26 Nov 2023 18:01:56 +0100 Subject: [PATCH 3/3] Update md formatting --- doc/contributing/collaborator-guide.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/contributing/collaborator-guide.md b/doc/contributing/collaborator-guide.md index db875173e26c54..2bf751b7076139 100644 --- a/doc/contributing/collaborator-guide.md +++ b/doc/contributing/collaborator-guide.md @@ -532,9 +532,10 @@ The TSC serves as the final arbiter where required. [build](https://github.com/nodejs/build/issues) repositories, open new issues. Run a new CI any time someone pushes new code to the pull request. 4. Check that the commit message adheres to [commit message guidelines][]. -5. Add all necessary [metadata](git-node-metadata) to commit messages before landing. If - you are unsure exactly how to format the commit messages, use the commit log - as a reference. See [this commit][commit-example] as an example. +5. Add all necessary [metadata][git-node-metadata] to commit messages before + landing. If you are unsure exactly how to format the commit messages, use + the commit log as a reference. See [this commit][commit-example] as an + example. For pull requests from first-time contributors, be [welcoming](#welcoming-first-time-contributors). Also, verify that their git