Skip to content

Commit c278a1d

Browse files
committed
Merge main into claude/add-claude-api-support-C5kDP
Resolved conflict in __init__.py comment: combined the expanded gist host description (gisthost.github.io or gistpreview.github.io) with the issue #26 reference.
2 parents e26aa10 + b7fed22 commit c278a1d

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ claude-code-transcripts json session.json --gist
102102
This will output something like:
103103
```
104104
Gist: https://gist.github.com/username/abc123def456
105-
Preview: https://gistpreview.github.io/?abc123def456/index.html
105+
Preview: https://gisthost.github.io/?abc123def456/index.html
106106
Files: /var/folders/.../session-id
107107
```
108108

109-
The preview URL uses [gistpreview.github.io](https://gistpreview.github.io/) to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gistpreview.
109+
The preview URL uses [gisthost.github.io](https://gisthost.github.io/) to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gisthost.
110110

111111
Combine with `-o` to keep a local copy:
112112

src/claude_code_transcripts/__init__.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,12 +1047,13 @@ def render_message(log_type, message_json, timestamp):
10471047
});
10481048
"""
10491049

1050-
# JavaScript to fix relative URLs when served via gistpreview.github.io
1051-
# Fixes issue #26: Pagination links broken on gistpreview.github.io
1050+
# JavaScript to fix relative URLs when served via gisthost.github.io or gistpreview.github.io
1051+
# Fixes issue #26: Pagination links broken on gisthost.github.io
10521052
GIST_PREVIEW_JS = r"""
10531053
(function() {
1054-
if (window.location.hostname !== 'gistpreview.github.io') return;
1055-
// URL format: https://gistpreview.github.io/?GIST_ID/filename.html
1054+
var hostname = window.location.hostname;
1055+
if (hostname !== 'gisthost.github.io' && hostname !== 'gistpreview.github.io') return;
1056+
// URL format: https://gisthost.github.io/?GIST_ID/filename.html
10561057
var match = window.location.search.match(/^\?([^/]+)/);
10571058
if (!match) return;
10581059
var gistId = match[1];
@@ -1114,7 +1115,7 @@ def render_message(log_type, message_json, timestamp):
11141115
startObserving();
11151116
11161117
// Handle fragment navigation after dynamic content loads
1117-
// gistpreview.github.io loads content dynamically, so the browser's
1118+
// gisthost.github.io/gistpreview.github.io loads content dynamically, so the browser's
11181119
// native fragment navigation fails because the element doesn't exist yet
11191120
function scrollToFragment() {
11201121
var hash = window.location.hash;
@@ -1402,7 +1403,7 @@ def cli():
14021403
@click.option(
14031404
"--gist",
14041405
is_flag=True,
1405-
help="Upload to GitHub Gist and output a gistpreview.github.io URL.",
1406+
help="Upload to GitHub Gist and output a gisthost.github.io URL.",
14061407
)
14071408
@click.option(
14081409
"--json",
@@ -1490,7 +1491,7 @@ def local_cmd(output, output_auto, repo, gist, include_json, open_browser, limit
14901491
inject_gist_preview_js(output)
14911492
click.echo("Creating GitHub gist...")
14921493
gist_id, gist_url = create_gist(output)
1493-
preview_url = f"https://gistpreview.github.io/?{gist_id}/index.html"
1494+
preview_url = f"https://gisthost.github.io/?{gist_id}/index.html"
14941495
click.echo(f"Gist: {gist_url}")
14951496
click.echo(f"Preview: {preview_url}")
14961497

@@ -1559,7 +1560,7 @@ def fetch_url_to_tempfile(url):
15591560
@click.option(
15601561
"--gist",
15611562
is_flag=True,
1562-
help="Upload to GitHub Gist and output a gistpreview.github.io URL.",
1563+
help="Upload to GitHub Gist and output a gisthost.github.io URL.",
15631564
)
15641565
@click.option(
15651566
"--json",
@@ -1621,7 +1622,7 @@ def json_cmd(json_file, output, output_auto, repo, gist, include_json, open_brow
16211622
inject_gist_preview_js(output)
16221623
click.echo("Creating GitHub gist...")
16231624
gist_id, gist_url = create_gist(output)
1624-
preview_url = f"https://gistpreview.github.io/?{gist_id}/index.html"
1625+
preview_url = f"https://gisthost.github.io/?{gist_id}/index.html"
16251626
click.echo(f"Gist: {gist_url}")
16261627
click.echo(f"Preview: {preview_url}")
16271628

@@ -1870,7 +1871,7 @@ def generate_html_from_session_data(session_data, output_dir, github_repo=None):
18701871
@click.option(
18711872
"--gist",
18721873
is_flag=True,
1873-
help="Upload to GitHub Gist and output a gistpreview.github.io URL.",
1874+
help="Upload to GitHub Gist and output a gisthost.github.io URL.",
18741875
)
18751876
@click.option(
18761877
"--json",
@@ -1984,7 +1985,7 @@ def web_cmd(
19841985
inject_gist_preview_js(output)
19851986
click.echo("Creating GitHub gist...")
19861987
gist_id, gist_url = create_gist(output)
1987-
preview_url = f"https://gistpreview.github.io/?{gist_id}/index.html"
1988+
preview_url = f"https://gisthost.github.io/?{gist_id}/index.html"
19881989
click.echo(f"Gist: {gist_url}")
19891990
click.echo(f"Preview: {preview_url}")
19901991

src/claude_code_transcripts/templates/search.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
// Show search box (progressive enhancement)
1919
searchBox.style.display = 'flex';
2020

21-
// Gist preview support - detect if we're on gistpreview.github.io
22-
var isGistPreview = window.location.hostname === 'gistpreview.github.io';
21+
// Gist preview support - detect if we're on gisthost.github.io or gistpreview.github.io
22+
var hostname = window.location.hostname;
23+
var isGistPreview = hostname === 'gisthost.github.io' || hostname === 'gistpreview.github.io';
2324
var gistId = null;
2425
var gistOwner = null;
2526
var gistInfoLoaded = false;

tests/__snapshots__/test_generate_html/TestGenerateHtml.test_generates_index_html.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ <h1>Claude Code transcript</h1>
221221
// Show search box (progressive enhancement)
222222
searchBox.style.display = 'flex';
223223

224-
// Gist preview support - detect if we're on gistpreview.github.io
225-
var isGistPreview = window.location.hostname === 'gistpreview.github.io';
224+
// Gist preview support - detect if we're on gisthost.github.io or gistpreview.github.io
225+
var hostname = window.location.hostname;
226+
var isGistPreview = hostname === 'gisthost.github.io' || hostname === 'gistpreview.github.io';
226227
var gistId = null;
227228
var gistOwner = null;
228229
var gistInfoLoaded = false;

tests/__snapshots__/test_generate_html/TestParseSessionFile.test_jsonl_generates_html.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ <h1>Claude Code transcript</h1>
212212
// Show search box (progressive enhancement)
213213
searchBox.style.display = 'flex';
214214

215-
// Gist preview support - detect if we're on gistpreview.github.io
216-
var isGistPreview = window.location.hostname === 'gistpreview.github.io';
215+
// Gist preview support - detect if we're on gisthost.github.io or gistpreview.github.io
216+
var hostname = window.location.hostname;
217+
var isGistPreview = hostname === 'gisthost.github.io' || hostname === 'gistpreview.github.io';
217218
var gistId = null;
218219
var gistOwner = null;
219220
var gistInfoLoaded = false;

tests/test_generate_html.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def mock_run(*args, **kwargs):
633633
assert result.exit_code == 0
634634
assert "Creating GitHub gist" in result.output
635635
assert "gist.github.com" in result.output
636-
assert "gistpreview.github.io" in result.output
636+
assert "gisthost.github.io" in result.output
637637

638638
def test_session_gist_with_output_dir(self, monkeypatch, output_dir):
639639
"""Test that session --gist with -o uses specified directory."""
@@ -664,9 +664,9 @@ def mock_run(*args, **kwargs):
664664

665665
assert result.exit_code == 0
666666
assert (output_dir / "index.html").exists()
667-
# Verify JS was injected
667+
# Verify JS was injected (checks for both domains for backwards compatibility)
668668
index_content = (output_dir / "index.html").read_text(encoding="utf-8")
669-
assert "gistpreview.github.io" in index_content
669+
assert "gisthost.github.io" in index_content
670670

671671

672672
class TestContinuationLongTexts:
@@ -911,7 +911,7 @@ def mock_run(*args, **kwargs):
911911
assert result.exit_code == 0
912912
assert "Creating GitHub gist" in result.output
913913
assert "gist.github.com" in result.output
914-
assert "gistpreview.github.io" in result.output
914+
assert "gisthost.github.io" in result.output
915915

916916

917917
class TestVersionOption:

0 commit comments

Comments
 (0)