Fix markdown and related issues#5344
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the documentation site’s “Copy Markdown” UX and publishing workflow to better handle missing Markdown sources and to prevent stale published output.
Changes:
- Add caching and improved error handling for fetching/copying Markdown source in the modern template JavaScript.
- Introduce a publish-path clearing step in the site build script before copying generated output.
- Update the local verification checklist to reflect both “Copy markdown” and “View as Markdown” actions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pages/templates/pnp-modern/public/main.js | Adds markdown source caching and improves clipboard fallback behavior for the Copy Markdown feature. |
| pages/Build-Site.ps1 | Adds a helper to clear existing published site output before copying the newly generated site. |
| pages/articles/buildingdocumentation.md | Updates the browser checklist wording to include both Copy and View Markdown actions. |
Comment on lines
+36
to
+44
| if (!markdownSourceCache.has(cacheKey)) { | ||
| markdownSourceCache.set(cacheKey, fetch(markdownSourceUrl, { cache: "no-store" }).then(response => { | ||
| if (!response.ok) { | ||
| throw new Error(`Unable to fetch markdown source: ${response.status}`); | ||
| } | ||
|
|
||
| return response.text(); | ||
| })); | ||
| } |
Comment on lines
+78
to
+80
| $resolvedPath = (Resolve-Path $Path).Path | ||
| $protectedPaths = @($SourceRoot, $PagesPath, $SitePath, [System.IO.Path]::GetPathRoot($resolvedPath)) | ||
|
|
Comment on lines
303
to
306
| if (![string]::IsNullOrWhiteSpace($PublishPath)) { | ||
| Write-Host "Copying generated site to $PublishPath" | ||
| Clear-PublishPath -Path $PublishPath | ||
| Copy-Item -Path (Join-Path $SitePath "*") -Destination $PublishPath -Force -Recurse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before creating a pull request, make sure that you have read the contribution file located at
https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md
Type
Related Issues?
Fixes #X, partially fixes #Y, mentioned in #Z, etc.
What is in this Pull Request ?
Please describe the changes in the PR.
Guidance