forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

appview: fix line number alignment

Changed files
+15 -15
appview
pages
templates
repo
+15 -15
appview/pages/templates/repo/blob.html
··· 4 {{ $lines := split .Contents }} 5 {{ $tot_lines := len $lines }} 6 {{ $tot_chars := len (printf "%d" $tot_lines) }} 7 - {{ $code_number_style := "text-gray-400 left-0 bg-white text-right mr-6 select-none" }} 8 {{ $linkstyle := "no-underline hover:underline" }} 9 <div class="pb-2 text-base"> 10 <div class="flex justify-between"> ··· 36 This is a binary file and will not be displayed. 37 </p> 38 {{ else }} 39 - <div class="overflow-auto relative text-ellipsis"> 40 - {{ range $idx, $line := $lines }} 41 - {{ $linenr := add $idx 1 }} 42 - <div class="flex"> 43 - <a href="#L{{ $linenr }}" id="L{{ $linenr }}" class="no-underline peer"> 44 - <span class="{{ $code_number_style }}" 45 - style="min-width: {{ $tot_chars }}ch;" > 46 - {{ $linenr }} 47 - </span> 48 - </a> 49 - <div class="whitespace-pre peer-target:bg-yellow-200">{{ $line | escapeHtml }}</div> 50 - </div> 51 - {{ end }} 52 - </div> 53 {{ end }} 54 {{ end }}
··· 4 {{ $lines := split .Contents }} 5 {{ $tot_lines := len $lines }} 6 {{ $tot_chars := len (printf "%d" $tot_lines) }} 7 + {{ $code_number_style := "text-gray-400 left-0 bg-white text-right mr-6 select-none inline-block w-12" }} 8 {{ $linkstyle := "no-underline hover:underline" }} 9 <div class="pb-2 text-base"> 10 <div class="flex justify-between"> ··· 36 This is a binary file and will not be displayed. 37 </p> 38 {{ else }} 39 + <div class="overflow-auto relative text-ellipsis"> 40 + {{ range $idx, $line := $lines }} 41 + {{ $linenr := add $idx 1 }} 42 + <div class="flex"> 43 + <a href="#L{{ $linenr }}" id="L{{ $linenr }}" class="no-underline peer"> 44 + <span class="{{ $code_number_style }}" 45 + style="min-width: {{ $tot_chars }}ch;"> 46 + {{ $linenr }} 47 + </span> 48 + </a> 49 + <div class="whitespace-pre peer-target:bg-yellow-200">{{ $line | escapeHtml }}</div> 50 + </div> 51 + {{ end }} 52 + </div> 53 {{ end }} 54 {{ end }}