Generate clickable Table of Contents with anchor links for your Substack posts.
Substack doesn't provide a built-in way to add a Table of Contents with working anchor links. This extension:
- Scans your post for headings (h1-h4)
- Generates anchor URLs that link directly to each section
- Lets you inject a formatted ToC into your post with one click
Coming soon
# Clone the repo
git clone https://github.com/olshansky/substack-toc.git
cd substack-tocThen in Chrome:
- Go to
chrome://extensions - Enable Developer mode (toggle in top right)
- Click Load unpacked
- Select the
substack-tocfolder
- Open any Substack post in edit mode (
yourname.substack.com/publish/post/...) - Click the extension icon in your toolbar
- Preview the generated ToC with clickable links
- Click Inject into Post to insert the ToC at your cursor position
You can also:
- Click any link to test it in a new tab
- Use Copy to grab individual anchor URLs
- Use Copy All to get the full ToC as markdown
- Extracts h1-h4 headings from your post
- Generates Substack-compatible anchor URLs
- Handles duplicate headings (adds
-1,-2suffixes) - One-click injection into ProseMirror editor
- Copy individual links or full markdown ToC
- Works with both published and draft posts
make help # List all targets
make dev-info # Print name and version
make dev-start # Steps to load in Chrome
make dev-clean # Delete build directories
make build-validate # Check required files exist
make build-zip # Create zip (no version bump)
make build-release # Bump version + create zipChrome Web Store Developer Console
To test changes:
- Make your edits
- Go to
chrome://extensions - Click the refresh icon on the extension card
Substack uses a predictable anchor URL format:
https://{subdomain}.substack.com/i/{postId}/{slug}
The extension:
- Extracts
subdomainandpostIdfrom the edit URL - Generates slugs by lowercasing headings and replacing spaces with hyphens
- Injects the ToC via a synthetic paste event (how Substack's editor expects content)
- Only works in Substack's post editor (not the reader view)
- Anchor links won't work until the post is published
- Slug generation follows Substack's algorithm but edge cases may exist
MIT