Fix Pagefind sub-results and highlighting
Use h6 headings for timestamps so Pagefind can anchor
sub-results. Add Pagefind native highlighting and scroll
to first match on episode pages.

Assisted-by: Claude Opus 4.6 via pi
change nwzzsnltzrktpwykuqqptmqoxzpromtn
commit 3b11dcef761cdaa87f0ceb5521cdb2bfca173a8b
author Alpha Chen <alpha@kejadlen.dev>
date
parent zznkyztw
diff --git a/Gemfile b/Gemfile
index e385e9f..783ef4b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,4 +2,5 @@ source "https://rubygems.org"
 
 gem "nokogiri"
 gem "puma"
+gem "rack"
 gem "rake"
diff --git a/Gemfile.lock b/Gemfile.lock
index fec29e6..4a27767 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -21,6 +21,7 @@ GEM
     puma (7.2.0)
       nio4r (~> 2.0)
     racc (1.8.1)
+    rack (3.2.6)
     rake (13.3.1)
 
 PLATFORMS
@@ -36,6 +37,7 @@ PLATFORMS
 DEPENDENCIES
   nokogiri
   puma
+  rack
   rake
 
 BUNDLED WITH
diff --git a/Rakefile b/Rakefile
index eb30521..962b3e1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -166,7 +166,7 @@ task serve: :pages do
   require "puma"
   require "puma/configuration"
   require "puma/launcher"
-  require "rack/files"
+  require "rack"
 
   files = Rack::Files.new(CONFIG.pages_dir.to_s)
   app = ->(env) do
diff --git a/lib/config.rb b/lib/config.rb
index ed7658d..7ce825d 100644
--- a/lib/config.rb
+++ b/lib/config.rb
@@ -17,7 +17,7 @@ module CookingIssues
   ) do
     def self.from_env(transcribers)
       cache_dir = Pathname("cache")
-      transcriber = transcribers.resolve(ENV.fetch("TRANSCRIBER", "sous_chef"), cache_dir: cache_dir)
+      transcriber = transcribers.resolve(ENV.fetch("TRANSCRIBER", "parakeet"), cache_dir: cache_dir)
 
       new(
         cache_dir: cache_dir,
diff --git a/lib/pages/episode.html.erb b/lib/pages/episode.html.erb
index 3c0ecef..12bde64 100644
--- a/lib/pages/episode.html.erb
+++ b/lib/pages/episode.html.erb
@@ -11,7 +11,8 @@
   .back { display: inline-block; margin-bottom: 1rem; color: #0066cc; text-decoration: none; }
   .back:hover { text-decoration: underline; }
   p { margin-bottom: 1em; }
-  .timestamp { color: #888; font-size: 0.85rem; font-family: monospace; }
+  h6.timestamp { color: #888; font-size: 0.85rem; font-family: monospace; font-weight: normal; margin-bottom: 0.25em; }
+  h6.timestamp + p { margin-top: 0; }
   :target { background: #fff3a8; }
   [data-pagefind-highlight] { background: #fff3a8; padding: 0 2px; border-radius: 2px; }
 </style>
@@ -22,9 +23,10 @@
 <h1><%= CGI.escapeHTML("#{ep[:number]}. #{ep[:title]}") %></h1>
 
 <% ep[:text].split("\n\n").each_with_index do |para, i| %>
-  <% if para =~ /\A\[([^\]]+)\]\s*(.*)/ %>
-    <% anchor = $1.gsub(/[^0-9:]/, "").gsub(":", "-") %>
-    <p id="t-<%= anchor %>"><span class="timestamp">[<%= CGI.escapeHTML($1) %>]</span> <%= CGI.escapeHTML($2) %></p>
+  <% if (m = para.match(/\A\[([^\]]+)\]\s*(.*)/)) %>
+    <% anchor = m[1].gsub(/[^0-9:]/, "").gsub(":", "-") %>
+    <h6 id="t-<%= anchor %>" class="timestamp">[<%= CGI.escapeHTML(m[1]) %>]</h6>
+    <p><%= CGI.escapeHTML(m[2]) %></p>
   <% else %>
     <p><%= CGI.escapeHTML(para) %></p>
   <% end %>