With this extension in HackMD, you can see TOC even in edit or split-view mode.
These features work in every mode. You can move by clicking an item in TOC
TOC settings are integrated into HackMD's dropdown menu (top-right menu button):
- Show/Hide TOC: Toggle TOC visibility
- TOC Settings: Open settings dialog
- Custom TOC Tab:
- Change opacity
- Change width
- Toggle visibility
- Expand Mode:
- Always: Always expand all sections
- Auto: Show h1/h2 always, expand h3+ only for active section
- Official TOC Tab:
- Opacity: Change HackMD's official TOC transparency
- Width: Change official TOC width
- Visibility:
- Persist: Keep TOC visible even when clicking outside (only toggle button closes it)
- Auto: Default HackMD behavior (clicking outside closes TOC)
- Custom TOC Tab:
- Gmail: [email protected]
MIT
See THIRD_PARTY_LICENSES.md for third-party license information.
./scripts/build.sh# Set DEPLOY_TARGET in .env
cp .env.example .env
# Edit .env and set DEPLOY_TARGET
./scripts/deploy.shhackmd-toc/
├── src/ # Source files
│ ├── manifest.json # Extension manifest (Manifest V3)
│ ├── content_script.js # Main logic (Vanilla JS)
│ ├── options.html # Options page
│ └── options_script.js # Options logic
├── scripts/ # Build & deploy scripts
│ ├── build.sh # Build to dist/
│ └── deploy.sh # Deploy to DEPLOY_TARGET
├── dist/ # Build output (gitignored)
└── img/ # Images
- Add Official TOC control feature (separate tab in settings)
- Opacity: Control HackMD's official TOC transparency
- Width: Change official TOC width
- Persist mode: Keep TOC visible even when clicking outside
- Settings dialog now uses tabs to separate Custom TOC and Official TOC settings
- Add Expand Mode setting (Always/Auto)
- Always: Always expand all sections
- Auto: Show h1/h2 always, expand h3+ only for active section
- Use custom CSS classes (chex-*) to avoid conflicts with HackMD styles
- Improve dark mode: use light background for TOC in dark mode
- Reduce font size for better readability
- Fix selector syntax errors
- Generate TOC from headings (no longer depends on HackMD's existing TOC)
- Integrate TOC settings into HackMD's dropdown menu
- Fix selectors for current HackMD DOM structure
- Fix CSSStyleDeclaration error in setStyles function
- Migrate to Manifest V3
- Remove jQuery dependency (Vanilla JS rewrite)
- Update selectors for current HackMD DOM structure
- Add build and deploy scripts

