-
-
Notifications
You must be signed in to change notification settings - Fork 165
GitHub table of contents
Rob Garrison edited this page Jan 18, 2018
·
58 revisions
A userscript that adds a table of contents to both readme and wiki pages.
- A draggable popup window is automatically added when rendered markdown is detected; there must be at least three anchors.
- The TOC will refresh while switching between pages, and previewing markdown changes.
- Click and hold on the header to move the TOC window. If it gets moved and you can't get it back, use the keyboard shortcut to reset the position.
- Click on the header icon to toggle the window between the upper right corner and its last position. Or use the keyboard shortcut to toggle the view.
- Each anchor within the rendered markdown will be included in the TOC window.
- Some anchor link text may be truncated, hover over the link to see the full title.
- Click on the arrow next to the anchor link to toggle the sub-group.
- Shift + Click on the arrow next to the anchor to toggle all same level items.
- To modify the "Table of Contents" text, open the userscript addon popup window and look for the "Set Table of Contents Title" setting.
- Keyboard commands:
- Press Esc to "hide" the TOC in the upper right corner.
- Press g + t, within one second of each other, to toggle the TOC view.
- Press g + r, within one second of each other, to reset the TOC position.
- Click this link to install from GitHub; or, install from GreasyFork or OpenUserJS.
- Then test it on this page.
- Update mutation script url.
- Update to use new header class.
- Change license to MIT.
- Update mutation url.
- Switch to using mutations.js.
- Include Gist pages.
- Collapse arrow now correctly groups sub-headers.
- Use pjax event & fix linting.
- Add link to docs.
- Clean up linting issues.
- Add z-index to icon (fixed header style) & convert to ES6
- Arrows will again collapse content.
- Only clicking on an arrow will toggle the sub-group.
- Shift + Click now toggles all same level items.
- Don't show TOC when less than 3 listings.
- Code cleanup.
- Prevent JS errors on pages with no ".header".
- Initial commit