From 501587e256a065816f7eb6007030e728955a32dc Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Thu, 3 Sep 2026 01:26:44 -0400 Subject: Anchor blob lines so #L fragments work Wrap each rendered line in a , for both syntax-highlighted and plain-text blobs, and shade the line a fragment targets. --- cgithub/views/blob.eta | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cgithub/views') diff --git a/cgithub/views/blob.eta b/cgithub/views/blob.eta index 444508e..be9a57e 100644 --- a/cgithub/views/blob.eta +++ b/cgithub/views/blob.eta @@ -22,9 +22,11 @@ <% } else if (it.htmlContent) { %>
<%~ it.htmlContent %>
<% } else if (it.htmlLines) { %> -
<%~ it.htmlLines.join("\n") %>
+
<% for (const [i, line] of it.htmlLines.entries()) {
+    %><%= i ? "\n" : "" %><%~ line %><% } %>
<% } else if (it.textLines) { %> -
<%= it.textLines.join("\n") %>
+
<% for (const [i, line] of it.textLines.entries()) {
+    %><%= i ? "\n" : "" %><%= line %><% } %>
<% } else { %>
This file cannot be displayed.
<% } %> -- cgit v1.3.1