build local index with optional local colophon #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a replacement for #21
Most of what's below the h1 is written by Claude 3.7 Sonnet, but here's the high-level by a human:
build_local_index.py
: This script generates a localindex.html
page to allow simple local browsing. The script takes the existingbuild_colophon.py as a starting point, incorporates a part of
gather_links.pyin case the purpose of that file changes, and can easily be run with inline dependencies (e.g.
uv run --no-project ./build_local_index.py`). This is the core of the PR..docs.md
files, with default alphabetical and optional last-modified sorting, a keyboard-accessible search bar to filter tools by any text in their name or description (/
to focus,␛
to dismiss), and a scroll-to-top button.README.md
: Added a new section "Local Browsing" with instructions on how to browse tools locally without setting up a server. This includes commands to install dependencies, build the local index, and descriptions of the local index features.UpdatedREADME.md
to mention thisbuild_colophon.py
: thebuild_colophon
function now accepts alocal_mode
parameter, allowing for the generation of local file links. The [get_most_recent_date
function](https://github.com/simonw/tools/pull/22/files#diff-19dd6a2ec16d1d36630576b40b9674ece335d7f6bd49aa0b89c8ab463c79ee45R162-R164) has also been modified to handle local file references when
local_mode` is enabled.It's not quite a Perfect Commit™ but I'm not a perfect developer :)
The tool index should be fully keyboard-accessible, with a search bar for filtering. The design is suitable for mobile although I haven't got it working on my phone.
Some things that were considered but dropped include categories, a table of contents (search/full list seems more usable), additional optimisations (dark mode, debounce for search), and including Python tools in the listing. Of course, this is your repo, so I completely understand if you don't want any of this - I found it useful to have a neat way to browse the list, with some neat learning bonuses. I've also spotted the new
side-panel-dialog.html
which looks like it handles the card layout much better than the options I was playing wth in the other PR.Claude transcript available on request although it's a branchy mess. Speaking of, over to our artificially intelligent friend for the details...
Add local browsing capability without server deployment
This PR adds a simple script that generates an index.html file for browsing
Simon's tools collection locally without needing to set up GitHub Pages or
any other server.
What this adds
How it works
The script:
How to test
uv run --no-project --with markdown ./build_local_index.py
(orpip install markdown && python build_local_index.py
)