Skip to content

Commit

Permalink
Install link in script content table
Browse files Browse the repository at this point in the history
  • Loading branch information
on committed Oct 3, 2025
1 parent be7ff52 commit c399d19
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions doc/generate-readme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $userJsFiles = Get-ChildItem -Path $UserScripts -Filter "*.user.js" -Recurse | S

$regEx = [regex]'\/\/\s+@(\w+)\s+(.+)'

$content_list = "| Script | Author | Version |`n|--------|--------|---------|`n"
$content_list = "| Script | Author | Install |`n|--------|--------|---------|`n"
$scriptList = ""

function New-GfmHeaderLink {
Expand Down Expand Up @@ -100,13 +100,14 @@ foreach ($file in $userJsFiles) {

$endOfCommentBlock = $false
$script_heading = " ### $name"
$content_list += "| " + (New-GfmHeaderLink -HeaderText $name) + " | $author | $version |" + "`n"
$scriptList += "$script_heading`n`n"
$scriptList += " - **Install:** "
if ($autoUpdate) { $color = "green" } else { $color = "blue" }
# Get the relative path from the root, replacing backslashes with forward slashes for URLs
$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"
$installLink = New-MDImage -Subject "$($file.Name)" -Status "$version" -Color $color -Link "https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$relativePath"
$content_list += "| " + (New-GfmHeaderLink -HeaderText $name) + " | $author | $installLink |" + "`n"
$scriptList += "$script_heading`n`n"
$scriptList += " - **Install:** "
$scriptList += $installLink
if ($author) {
$scriptList += "`n - **Author:** $author`n"
}
Expand Down

0 comments on commit c399d19

Please sign in to comment.