Files
winutil/tools/devdocs-generator.md
T
Sean (ANGRYxScotsman)andGitHub e96f990c60 Fix alignment issues, update links, and enhance documentation (#4898)
* Fix the same arrow-icon alignment issue on the "Read the Docs" button

Same root cause as the hero/final-CTA buttons: the label was plain
markdown text, which MDX wrapped in a <p>, and the icon was missing
the size/nudge applied elsewhere. Match it to the other two buttons.

* Rename known-issues page slug to knownissues

Update the sidebar config, nav dropdown, and every internal link that
pointed at /known-issues/ to match.

* Fix image paths in root-level markdown to match the new docs site

The Hugo docs site (docs/assets/images/...) has been replaced by the
Astro site (docs/src/assets/...); update CONTRIBUTING.md,
READMEITALIAN.md, and README.md to point at the new asset locations.

* Remove unused houston.webp asset

Leftover Starlight default-theme asset with no references anywhere
in the docs site.

* Fix docs site reference in generator docs

Updates `tools/devdocs-generator.md` to describe link generation correctly: links now point to the Astro/Starlight documentation site instead of the old Hugo site.

* Point docs homepage CTAs to guides hub

Updates the docs landing page CTA links to use `/guides/` instead of `/guides/getting-started/` in the hero action and both “Get Started”/“Read the Docs” buttons, routing users to the guides index.

* Add reusable YouTube embeds to docs guides

Introduces a new `YouTubeEmbed.astro` component for responsive 16:9 video embeds using the privacy-enhanced `youtube-nocookie.com` domain. The User Guide index and Tweaks guide now import and use this component instead of plain YouTube links, and the component includes styling that overrides Starlight’s iframe reset so embedded videos render at the correct size.

* Fix YouTube embed iframe height via not-content

Add the `not-content` class to the embed wrapper so Starlight's markdown reset no longer overrides `iframe { height: auto }`. Drop the `@layer starlight.core` wrapper and `!important` overrides that were compensating for the same issue.

* Clarify docs comments across Astro components

Adds and refines inline comments in the docs site config, custom Starlight components, and theme styles to better explain layout structure, navigation dropdown behavior, hero composition, and theme initialization. Also normalizes a few multi-line comments into single-line form for readability without changing functionality.

* Set secondary docs button background color

Update `.wu-btn-secondary` in the docs theme to use `var(--sl-color-gray-6)` instead of a transparent background, improving button visibility and contrast while keeping existing border and hover behavior.

* Move User Guides into docs dropdown

Updates the docs header navigation so the “User Guides” link is grouped under the existing “Documentation” dropdown instead of appearing as a separate top-level nav item. This keeps related documentation links together and simplifies the top navigation.

* Fix hero margin and center trust section

Remove the automatic 1.5rem top margin Starlight adds between the hero and the content column. Also flex-center the trust section so its content is properly aligned.

* Disable edit links in generated dev docs

Update `tools/devdocs-generator.ps1` to include `editUrl: false` in the frontmatter for generated tweak and feature docs pages. This prevents Starlight from showing edit links on these auto-generated pages.

* Move docs update PRs to pre-release flow

The docs Pages workflow is simplified to only build and deploy the docs site: it now triggers only on docs changes, drops extra permissions/default shell settings, and removes the dev-docs generation + auto-PR steps. The pre-release workflow now owns that automation by expanding its PR step to include generated code-reference docs alongside JSON link updates, with updated commit/title/body text and a documentation label.

* Shorten generated docs source note

Simplify the autogenerated DevDocs notice so generated pages only warn against direct edits while still linking back to the source file.

* Improve docs header dropdown behavior

Reworked the header nav dropdown triggers to use native `<details>/<summary>` instead of buttons, then updated menu visibility logic to use `details[open]` for no-JS support on touch and keyboard while preserving hover behavior. Also renamed the “Developer Docs” link to “Code Reference” and tightened related CSS comments.

* Refresh contribution and docs workflow docs

Updated contributor-facing docs to use consistent Markdown admonition blocks, cleaned Mermaid fence formatting, and fixed minor wording/capitalization in contribution steps. Clarified `devdocs-generator` behavior so workflow ownership is explicit: generation now documented as part of `pre-release.yaml` (via docs-update PR), while `docs.yaml` is documented as build/deploy only.

* Fix contributing guide grammar

Correct the "it's" to "its" typo in both contributing guides so the pull request guidance is consistent across the GitHub and docs versions.
2026-08-03 10:23:31 -05:00

5.0 KiB

title, description
title description
Dev Docs Generator How the devdocs-generator.ps1 script works

Dev Docs Generator

The devdocs-generator.ps1 script automatically generates Astro/Starlight markdown (.mdx) files for the development documentation. It pulls content directly from the JSON config files and PowerShell function files so the docs never go out of sync.

When Does it Run?

  • Automatically runs as part of the pre-release.yaml GitHub Actions workflow (manually triggered via workflow_dispatch), which regenerates the .mdx files and updates the "link" properties in the JSON config files
  • pre-release.yaml then opens a docs-update pull request with those changes; auto-merge-docs.yaml auto-approves and merges it into main
  • That merge pushes changes under docs/**, which triggers docs.yaml — but docs.yaml only builds and deploys the Astro site, it does not run the generator itself
  • Can also be run manually/locally from tools/ (./devdocs-generator.ps1)

What Does It Do?

1. Loads the Data

  • Reads config/tweaks.json and config/feature.json
  • Reads all .ps1 function files from functions/public/ and functions/private/
  • Parses Invoke-WPFButton.ps1 to build a mapping of button names to their function names
  • Adds or updates a "link" property on every entry in both JSON config files
  • Each link points to that entry's documentation page on the Astro/Starlight site
  • The updated links are automatically committed back to the JSON config files as part of the pre-release workflow

3. Cleans Up Old Docs

  • Deletes all .mdx files from docs/src/content/docs/code-reference/tweaks/ and docs/src/content/docs/code-reference/features/
  • This prevents duplicate or orphaned files from previous runs
  • No category index.mdx landing pages exist yet; if one is added later, the matching exclusion in the script is left commented out ready to re-enable

4. Generates Tweak Documentation

For each entry in tweaks.json that belongs to a documented category:

  • Button type entries get the mapped PowerShell function file embedded
  • All other types get the raw JSON snippet embedded with correct line numbers from the source file
  • Entries with registry changes get a Registry Changes section added

5. Generates Feature Documentation

For each entry in feature.json that belongs to a documented category:

  • Fixes and Legacy Windows Panels get the mapped PowerShell function file embedded
  • Features get the raw JSON snippet embedded with correct line numbers

6. Output Format

  • Every .mdx file gets Starlight frontmatter with title and description (description comes from the entry's Description field when present)
  • A :::note aside points back at the source file (JSON config or PowerShell function) it was generated from
  • Code blocks use Starlight/Expressive Code syntax with a title attribute naming the source file
  • Files are organized into category subdirectories matching the JSON category field

Documented Categories

The script generates docs for entries in these categories:

  • Essential Tweaks
  • z--Advanced-Tweaks---CAUTION
  • Customize Preferences
  • Performance Plans
  • Features
  • Fixes
  • Legacy Windows Panels

File Structure

docs/src/content/docs/code-reference/
  tweaks/
    Essential-Tweaks/
    z--Advanced-Tweaks---CAUTION/
    Customize-Preferences/
    Performance-Plans/
  features/
    Features/
    Fixes/
    Legacy-Windows-Panels/

The Starlight sidebar picks these up automatically via autogenerate entries in docs/astro.config.mjs for the code-reference/tweaks and code-reference/features directories, so no sidebar edits are needed when new entries are added.

How File Names Are Derived

The script strips common prefixes from the JSON key names using the pattern WPF(WinUtil|Toggle|Features?|Tweaks?|Panel|Fix(es)?)?. For example:

JSON Key Generated File
WPFTweaksHiber Hiber.mdx
WPFTweaksDeBloat DeBloat.mdx
WPFFeatureshyperv hyperv.mdx
WPFPanelDISM DISM.mdx

Key Points

  • The JSON config files are the single source of truth
  • Manual edits to generated .mdx files will be overwritten on the next run
  • The script only touches docs/src/content/docs/code-reference/tweaks/ and .../features/architecture.mdx and any other hand-written page under code-reference/ are untouched — if a category index.mdx landing page is added inside tweaks/ or features/, uncomment the exclusion in the cleanup step first, or it will be deleted on the next run
  • Category directories are created automatically if they don't exist
  • The "link" property added to JSON entries is excluded from the displayed code blocks
  • The pre-release workflow generates both the .mdx files and the "link" properties, and commits them back to the repo via the docs-update PR
  • The docs workflow never runs the generator — it only builds and deploys the already-committed Astro site