1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
snippets-legacy/layouts/shortcodes/github_file.html

10 lines
342 B
HTML

{{ $repo := .Get "repo" }}
{{ $path := .Get "path" }}
{{ $extension := index (last 1 (split $path ".")) 0 }}
{{ $data := getJSON "https://api.github.com/repos/" $repo "/contents/" $path }}
{{ $content := $data.content | base64Decode }}
{{ highlight $content $extension "" }}
<p><a href="{{ $data.html_url }}">View {{ $data.name }}</a></p>