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 }}
|
|
|
|
{{ $githubDirReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/.github/README.md" $repo }}
|
2024-03-14 01:45:09 +01:00
|
|
|
|
2024-03-14 01:51:20 +01:00
|
|
|
{{ $response := getJSON $rootReadmeURL }}
|
|
|
|
|
|
|
|
{{ if not (isset $response "content") }}
|
|
|
|
{{ $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 }}
|
|
|
|
<p>Error fetching README from GitHub.</p>
|
|
|
|
{{ end }}
|
|
|
|
{{ else }}
|
|
|
|
<p>Error fetching data from GitHub API.</p>
|
|
|
|
{{ end }}
|
2024-03-14 01:51:20 +01:00
|
|
|
|