2024-03-14 01:45:09 +01:00
|
|
|
{{ $repo := .Get "repo" }}
|
2024-03-14 01:51:20 +01:00
|
|
|
{{ $rootReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/README.md" $repo }}
|
2024-03-14 01:45:09 +01:00
|
|
|
|
2024-03-14 01:51:20 +01:00
|
|
|
{{ $response := getJSON $rootReadmeURL }}
|
2024-03-14 02:01:28 +01:00
|
|
|
{{ $githubDirReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/.github/README.md" $repo }}
|
2024-03-14 01:51:20 +01:00
|
|
|
|
2024-03-14 02:01:28 +01:00
|
|
|
{{ if and (not $response) (not (isset $response "content")) }}
|
2024-03-14 01:51:20 +01:00
|
|
|
{{ $response = getJSON $githubDirReadmeURL }}
|
|
|
|
{{ end }}
|
2024-03-14 01:45:09 +01:00
|
|
|
|
|
|
|
{{ with $response }}
|
|
|
|
{{ if isset . "content" }}
|
|
|
|
{{ $content := .content | base64Decode }}
|
|
|
|
{{ $markdown := $content | markdownify }}
|
|
|
|
<div class="readme-content">
|
|
|
|
{{ $markdown | safeHTML }}
|
|
|
|
</div>
|
|
|
|
{{ else }}
|
2024-03-14 02:01:28 +01:00
|
|
|
<p>No README found for the repository.</p>
|
2024-03-14 01:45:09 +01:00
|
|
|
{{ end }}
|
|
|
|
{{ else }}
|
2024-03-14 02:01:28 +01:00
|
|
|
<p>Error fetching README from GitHub.</p>
|
2024-03-14 01:45:09 +01:00
|
|
|
{{ end }}
|