Skip to content

Commit 63e84f0

Browse files
committed
Update generate_projects_page.ps1
1 parent cbd3f07 commit 63e84f0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

generate_projects_page.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ function KebabToTitle($text)
4747
return $words -join ' '
4848
}
4949

50+
# helper function to convert github video links to HTML video embeds
51+
function Convert-GitHubVideos($content) {
52+
# regex to match github video links: [](https://github.com/...)
53+
$pattern = "\[\]\((https://github\.com/user-attachments/assets/[a-f0-9\-]+)\)"
54+
55+
# replace each match with HTML video embed
56+
return [regex]::Replace($content, $pattern, {
57+
param($match)
58+
$url = $match.Groups[1].Value
59+
return "<video width=`"100%`" controls>`n <source src=`"$url`">`n</video>"
60+
})
61+
}
62+
5063
foreach ($url in $projectUrls)
5164
{
5265
$weight = $projectUrls.IndexOf($url) + 1
@@ -98,6 +111,7 @@ weight: $weight
98111
"@
99112

100113
# combine into final markdown page
114+
# $readmeContent = Convert-GitHubVideos $readmeContent
101115
$finalContent = $frontMatter + "`n" + $readmeContent
102116
$outputFile = Join-Path $outputDir "$repo.md"
103117
$finalContent | Out-File -FilePath $outputFile -Encoding UTF8

0 commit comments

Comments
 (0)