From faaec8626c16a768f802fc8675d97ca40d132c61 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 13 Oct 2025 15:10:47 +0200 Subject: [PATCH 1/5] Add initial documentation for the site, outlining features and contribution guidelines --- docs/about.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/about.md diff --git a/docs/about.md b/docs/about.md new file mode 100644 index 0000000..d035480 --- /dev/null +++ b/docs/about.md @@ -0,0 +1,13 @@ +# About This Site + +This is a test documentation site built with MkDocs and Material theme. + +## Features + +- Versioned documentation using Mike +- Automated deployment via GitHub Actions +- Pull request previews + +## Getting Started + +To contribute, create a pull request and see the preview at `pr-{number}`. From f6de5cf71bff2c21df5f48d071815c2e2f623cfd Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 13 Oct 2025 15:16:01 +0200 Subject: [PATCH 2/5] Add version selector JavaScript and update mkdocs configuration --- .github/workflows/pages.yml | 1 + docs/js/version-selector.js | 23 +++++++++++++++++++++++ mkdocs.yml | 2 ++ 3 files changed, 26 insertions(+) create mode 100644 docs/js/version-selector.js diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e7be44b..44e16e3 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -40,6 +40,7 @@ jobs: mike delete --push $version } else { mike deploy --push $version + gh pr comment $prNumber --body "Documentation preview available at https://psmodule.github.io/docs-test/$version/" } } else { mike deploy --push --update-aliases 0.3 latest diff --git a/docs/js/version-selector.js b/docs/js/version-selector.js new file mode 100644 index 0000000..613e451 --- /dev/null +++ b/docs/js/version-selector.js @@ -0,0 +1,23 @@ +document.addEventListener('DOMContentLoaded', function () { + const select = document.querySelector('.md-version select'); + if (select) { + const options = Array.from(select.options); + options.sort((a, b) => { + const va = a.value; + const vb = b.value; + if (va === 'latest') return -1; + if (vb === 'latest') return 1; + if (va.startsWith('pr-') && vb.startsWith('pr-')) { + return parseInt(vb.substring(3)) - parseInt(va.substring(3)); + } + if (va.startsWith('pr-')) return 1; + if (vb.startsWith('pr-')) return -1; + // For other versions, assume semver-like, sort descending + return vb.localeCompare(va, undefined, { numeric: true, sensitivity: 'base' }); + }); + select.innerHTML = ''; + options.forEach(opt => select.appendChild(opt)); + // Trigger change to update current display if needed + select.dispatchEvent(new Event('change')); + } +}); diff --git a/mkdocs.yml b/mkdocs.yml index 0df2765..c341689 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,6 +7,8 @@ extra: provider: mike alias: true default: latest +extra_javascript: + - js/version-selector.js plugins: - mike: alias_type: symlink From 05cac97c5b09e3fa585b6e7df9e045990bdd178f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 13 Oct 2025 15:18:14 +0200 Subject: [PATCH 3/5] Update permissions in GitHub Actions workflow to ensure pull request access --- .github/workflows/pages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 44e16e3..4c29287 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -10,6 +10,7 @@ on: permissions: contents: write + pull-requests: write jobs: deploy: From 9972d9c3fe9b61962d9055261262801c5547608b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 13 Oct 2025 15:28:40 +0200 Subject: [PATCH 4/5] Update deployment command to set documentation preview as hidden for pull requests --- .github/workflows/pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 4c29287..f970359 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -40,7 +40,7 @@ jobs: if ($action -eq 'closed') { mike delete --push $version } else { - mike deploy --push $version + mike deploy --push $version --prop-set hidden=true gh pr comment $prNumber --body "Documentation preview available at https://psmodule.github.io/docs-test/$version/" } } else { From b46d24c4d2b3c3c8f26a7c028b9f03f943af883b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 13 Oct 2025 15:29:24 +0200 Subject: [PATCH 5/5] Remove version selector JavaScript and default version setting from mkdocs configuration --- docs/js/version-selector.js | 23 ----------------------- mkdocs.yml | 3 --- 2 files changed, 26 deletions(-) delete mode 100644 docs/js/version-selector.js diff --git a/docs/js/version-selector.js b/docs/js/version-selector.js deleted file mode 100644 index 613e451..0000000 --- a/docs/js/version-selector.js +++ /dev/null @@ -1,23 +0,0 @@ -document.addEventListener('DOMContentLoaded', function () { - const select = document.querySelector('.md-version select'); - if (select) { - const options = Array.from(select.options); - options.sort((a, b) => { - const va = a.value; - const vb = b.value; - if (va === 'latest') return -1; - if (vb === 'latest') return 1; - if (va.startsWith('pr-') && vb.startsWith('pr-')) { - return parseInt(vb.substring(3)) - parseInt(va.substring(3)); - } - if (va.startsWith('pr-')) return 1; - if (vb.startsWith('pr-')) return -1; - // For other versions, assume semver-like, sort descending - return vb.localeCompare(va, undefined, { numeric: true, sensitivity: 'base' }); - }); - select.innerHTML = ''; - options.forEach(opt => select.appendChild(opt)); - // Trigger change to update current display if needed - select.dispatchEvent(new Event('change')); - } -}); diff --git a/mkdocs.yml b/mkdocs.yml index c341689..b45bd19 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,9 +6,6 @@ extra: version: provider: mike alias: true - default: latest -extra_javascript: - - js/version-selector.js plugins: - mike: alias_type: symlink