Inline documentation in NuGet package README to fix broken links#388
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughThis PR changes global.json to set the .NET SDK version from 10.0.102 to 10.0.101 (rollForward remains "latestMinor"). It adds scripts/Inline-Readme.ps1, a PowerShell script that inlines docs/*.md into a README by extracting each doc's first heading, generating GitHub-style anchors, replacing links, and appending an "Additional Documentation" section. The NuGetLicenseCore.csproj removes PackageReadmeFile and packaged README/docs content entries, and adds a GenerateInlinedReadme MSBuild target (BeforeTargets="_GetPackageFiles") that runs the PowerShell script and declares the generated inlined README for packaging. Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
|
@copilot Make sure to use IntermediateOutputPath to generate a temporary path for the generated readme file |
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
Updated to use |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
@copilot address nitpick comments |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
🏁 Script executed: Length of output: 4191 🏁 Script executed: Length of output: 2559 Plan: Address nitpick commentsI'll address both nitpick comments:
💡 Use |
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
Addressed both nitpick comments:
(commit 880cad2) |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@scripts/Inline-Readme.ps1`:
- Around line 46-52: The heading removal regex is not using multiline mode so
the -replace '^\s*#\s+.+$' won't match the title when $docContent contains
multiple lines; update the replacement to run in multiline mode (e.g., apply the
(?m) inline modifier or use [regex]::Replace with RegexOptions.Multiline) when
computing $docContentWithoutTitle so the first heading is removed correctly
while keeping the existing $titleMatch/$docTitle logic intact.
- Around line 83-85: The replacement loop currently only matches the exact
$replacement.OriginalLink and therefore misses links with different link text
and mis-handles literal '$' in $replacement.NewLink; change the replacement to
use a regex that matches markdown links by filename (e.g. build a pattern that
targets "\[[^\]]+\]\(\s*<escaped-filename>\s*\)" using $replacement.Filename or
similar) and call [regex]::Replace on $inlinedReadme with that pattern so any
link text is preserved; when constructing the replacement string use the
captured group for the link text and ensure you escape any '$' in
$replacement.NewLink (replace '$' with '$$' or use a MatchEvaluator delegate) so
'$' is not interpreted as a backreference.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
scripts/Inline-Readme.ps1src/NuGetLicenseCore/NuGetLicenseCore.csproj
🚧 Files skipped from review as they are similar to previous changes (1)
- src/NuGetLicenseCore/NuGetLicenseCore.csproj
🔇 Additional comments (1)
scripts/Inline-Readme.ps1 (1)
99-103: Output directory creation is solid.Good defensive guard before writing the file.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
|
@copilot In |
|
@copilot In |
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
Fixed the replacement logic to:
The replacement now handles cases like:
All get replaced with the same anchor link. (commit 6ca21d9) |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com>
Fixed heading removal to use |
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|



Fix NuGet Package Documentation Links
The issue is that when the package is published to nuget.org, the README contains relative links to documentation files (e.g.,
docs/input-json.md). While these docs are included in the NuGet package, NuGet only displays the README file and doesn't make the other markdown files accessible, causing the links to fail.Solution Summary:
This PR implements a build-time script that automatically inlines all documentation into the NuGet package README. When users view the package on nuget.org, they'll see a single, comprehensive README with all documentation sections included and fully functional anchor links.
Changes Made:
Created PowerShell script (
scripts/Inline-Readme.ps1) that:$, backticks, etc.)Updated
src/NuGetLicenseCore/NuGetLicenseCore.csproj:GenerateInlinedReadmetarget that runs before packIntermediateOutputPathwith proper path combining for temporary file generationUpdated
global.jsonto use SDK 10.0.101 (available SDK version)Addressed code review feedback:
[^\w\s-]to[^a-z0-9\s-]to properly strip underscores and UnicodeIntermediateOutputPathinstead of hardcodedobjdirectorySystem.IO.Path.Combine()to handle trailing slashes$)RegexOptions.Multilinefor correct behaviorTesting Completed:
dotnet packREADME-nuget.md(402 lines) with all 7 documentation sections inlinedResult:
Users viewing the package on nuget.org will now see a complete README with all documentation properly linked and accessible in a single page.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by CodeRabbit
Chores
New Features
✏️ Tip: You can customize this high-level summary in your review settings.