8000 Add an index page for local browsing without a server by pressdarling · Pull Request #21 · simonw/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add an index page for local browsing without a server #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,27 @@ On [Observable](https://observablehq.com/):
- [Weeknotes](https://observablehq.com/@simonw/weeknotes) helps me write my [weeknotes](https://simonwillison.net/tags/weeknotes/)
- [Convert Claude JSON to Markdown](https://observablehq.com/@simonw/convert-claude-json-to-markdown) for sharing Claude conversation transcripts
- [Hacker News homepage with links to comments ordered by most recent first](https://observablehq.com/@simonw/hacker-news-homepage)

## Local Browsing

To browse these tools locally without setting up a server:

```bash
# Install dependencies and build the local index
uv run --no-project --with markdown ./build_local_index.py

# Or using pip
pip install markdown
python build_local_index.py
```

This creates `index.html` as a searchable and filterable index of all locally-available HTML tools with descriptions if available.

You can also choose to build `colophon.html` locally, if it doesn't already exist, which contains the development history with links to LLM transcripts (if it doesn't already exist),

The local index provides:

- Keyboard-accessible functionality to find tools by name or description
- Sorting by name or recent update date
- Direct links to open tools in your browser
- Tool descriptions from `.docs.md` files
14 changes: 12 additions & 2 deletions build_colophon.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ def format_commit_message(message):
return linkified.replace("\n", "<br>")


def build_colophon():
def build_colophon(data=None, local_mode=False):
"""
Build the colophon.html page with development history

Args:
data (dict, optional): The gathered links data. If None, load from file.
local_mode (bool, optional): If True, generate local file links. Default False.
"""
# Load the gathered_links.json file
try:
with open("gathered_links.json", "r") as f:
Expand Down Expand Up @@ -152,7 +159,10 @@ def get_most_recent_date(page_data):

# Add each page with its commits
for page_name, page_data in sorted_pages:
tool_url = f"https://tools.simonwillison.net/{page_name.replace('.html', '')}"
if local_mode:
tool_url = f"{page_name}" # Local file reference
else:
tool_url = f"https://tools.simonwillison.net/{page_name.replace('.html', '')}"
commits = page_data.get("commits", [])

# Reverse the commits list to show oldest first
Expand Down
Loading
0