Skip to content

Conversation

@Arlodotexe
Copy link
Member

@Arlodotexe Arlodotexe commented Apr 1, 2025

Fixed an issue where inline mslearn code samples weren't generated when [ToolkitSample(somevalue)] is used instead of [ToolkitSample(id: somevalue)]

Closes #276

… when `[ToolkitSample(somevalue)]` is instead of `[ToolkitSample(id: somevalue)]`
@Arlodotexe Arlodotexe self-assigned this Apr 1, 2025
@michael-hawker
Copy link
Member

@Arlodotexe it'd be good to document this a bit more while we're here. It only works if you run from the components folder, maybe we should make it more robust so that it can run from the tooling and repo root as well?

One trick I did this time too was clone the MicrosoftDocs/CommunityToolkit repo and run the command like:

I:\code\WindowsToolkit\components>powershell ..\tooling\Build-Toolkit-Docs.ps1 -OutputDir ..\..\CommunityToolkitDocs\docs\windows

So it'd directly update the docs in a branch I can submit for PR. In the line 101 if for skipping when no samples, I added an output as well:

Write-Host 'No Samples, Skipping:', $componentName

That helped me understand that it was seeing the components from wherever I ran it, but then wasn't finding the proper relative path.

@michael-hawker
Copy link
Member

I need to regenerate without Labs components, I did notice we have the intro section which I think is just here and not in our main repo. Also, we have a couple of extra links (to labs and the gallery). So it'd be good to think of in the future ways to weave those in for automation.

I'm seeing the short-links for the code samples now:
image

But I'm trying to remember how that pathing works, as we don't have a copy of the code in this repo. Though I do see that working for things like Triggers today: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/windows/triggers/

Ah, it's defined here: https://github.com/MicrosoftDocs/CommunityToolkit/blob/12b54cfcf1f476d1e8b44750fcade525a4da7d28/.openpublishing.publish.config.json#L30-L36

We should have a comment about how this works and point this out. As if other toolkits want to do this, then we need to have new entries there

@michael-hawker
Copy link
Member

Future thought: It'd be hard, but maybe easier with Uno, is if we could get snapshots of the samples running (first frame) and save out a png which we could then have above each sample code section, as the docs are all just blocks of text right now. Could be good to insert headers above them too for some visual separation and linking

@Arlodotexe
Copy link
Member Author

Arlodotexe commented Apr 3, 2025

It only works if you run from the components folder, maybe we should make it more robust so that it can run from the tooling and repo root as well?

The Build-Toolkit-Docs.ps1 script was designed to be run from the root only. Running without arguments will output to the ./docs folder in the repo root. From there, they're usually quick-inspected for issues and copied over to the official docs repo, or you can supply a custom OutputDir like you did here.

@Arlodotexe
Copy link
Member Author

It looks like the WIP check is stuck here?

@Arlodotexe Arlodotexe merged commit f12b7d9 into main Apr 14, 2025
11 checks passed
@Arlodotexe Arlodotexe deleted the fix/docs/wiki/inline-code-mslearn branch April 14, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc export script isn't including samples in some cases

2 participants