9 lines
625 B
1
{{ define "repoContent" }}
2
{{ $lines := split .Contents }}
3
{{ $tot_lines := len $lines }}
4
{{ $tot_chars := len (printf "%d" $tot_lines) }}
5
{{ $code_number_style := "code-line-num text-gray-400 mr-2 px-1 sticky left-0 bg-white border-r border-black text-right w-[{{$tot_chars}}rem]" }}
6
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
7
<span class="{{ $code_number_style }}">{{ add $idx 1 }}</span>
8
<span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>
9
{{ end }}
10