From 859a97c8258e48e0005e4a6734e86cfe60f8abfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Fri, 3 Oct 2025 10:45:19 +0200 Subject: [PATCH] Trying to fix the broken install links --- doc/generate-readme.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/generate-readme.ps1 b/doc/generate-readme.ps1 index 22c1f5b..c619c92 100644 --- a/doc/generate-readme.ps1 +++ b/doc/generate-readme.ps1 @@ -105,7 +105,7 @@ foreach ($file in $userJsFiles) { $scriptList += " - **Install:** " if ($autoUpdate) { $color = "green" } else { $color = "blue" } # Get the relative path from the root, replacing backslashes with forward slashes for URLs - $relativePath = $file.FullName.Replace($rootDir + "\", "").Replace("\", "/") + $relativePath = [System.IO.Path]::GetRelativePath($rootDir, $file.FullName).Replace("\", "/") $scriptList += New-MDImage -Subject "$($file.Name)" -Status "$version" -Color $color -Link "https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$relativePath" if ($author) { $scriptList += "`n - **Author:** $author`n" @@ -140,7 +140,7 @@ foreach ($file in $userJsFiles) { $extraDoc = Get-Content $docFile -Raw # Replace relative image links with absolute links from the script's subfolder - $relativeScriptPath = $currentScriptDir.Replace($rootDir + "\", "").Replace("\", "/") + $relativeScriptPath = [System.IO.Path]::GetRelativePath($rootDir, $currentScriptDir).Replace("\", "/") # Replace relative image links (simple filenames with common image extensions) $extraDoc = $extraDoc -replace '\!\[([^\]]+)\]\(([^/)]+\.(gif|png|jpg|jpeg|webp|svg))\)', "![`$1]($relativeScriptPath/`$2)"