From 2ccb09e67a32165013e55e92c0a862f446d57ae7 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 30 Sep 2026 19:03:06 +0200 Subject: [PATCH] fix(package): the Thunderstore README has no in-page anchor links Thunderstore renders the README on the mod page but does not resolve anchors, so links like [changelog](#v151) went nowhere. The package now gets a copy with those links turned into plain text, as nexus-readme.py already does for Nexus. The repo README keeps them, since they work on the wiki and the git host. --- scripts/package.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/package.ps1 b/scripts/package.ps1 index 9993c0a..8d20c8e 100644 --- a/scripts/package.ps1 +++ b/scripts/package.ps1 @@ -41,11 +41,20 @@ $texts = Get-ChildItem $root -Recurse -File -Filter *.json | ForEach-Object { # release is numbered. $version = (Get-Content $Manifest -Raw | ConvertFrom-Json).version_number +# Thunderstore renders the README on the mod page but does not resolve in-page anchors, so a +# link like [changelog](#v151) goes nowhere there. The package gets a copy with those links turned +# into plain text - the same thing nexus-readme.py does for Nexus. The README in the repo keeps +# them, because they work on the wiki and on the git host. +$readmeText = [System.IO.File]::ReadAllText((Resolve-Path $Readme).Path) +$readmeText = [regex]::Replace($readmeText, '\[([^\]]+)\]\(#[^)]*\)', '$1') +$packagedReadme = Join-Path ([System.IO.Path]::GetTempPath()) ("RacesOfValheim_README_" + [guid]::NewGuid().ToString('N') + ".md") +[System.IO.File]::WriteAllText($packagedReadme, $readmeText, (New-Object System.Text.UTF8Encoding($false))) + # Thunderstore gives every package a folder of its own, so the texts sit at the zip root. $thunderstore = @( [pscustomobject]@{ Source = $Dll; Name = 'RacesOfValheim.dll' } [pscustomobject]@{ Source = $Manifest; Name = 'manifest.json' } - [pscustomobject]@{ Source = $Readme; Name = 'README.md' } + [pscustomobject]@{ Source = $packagedReadme; Name = 'README.md' } [pscustomobject]@{ Source = $Icon; Name = 'icon.png' } ) + ($texts | ForEach-Object { [pscustomobject]@{ Source = $_.Source; Name = "Translations/$($_.Rel)" } }) @@ -56,3 +65,5 @@ $nexus = @( New-ModZip (Join-Path $OutDir "RacesOfValheim_Thunderstore_$version.zip") $thunderstore New-ModZip (Join-Path $OutDir "RacesOfValheim_Nexus_$version.zip") $nexus + +Remove-Item $packagedReadme -Force