Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork178
GitHub collapse in comment
Rob Garrison edited this pageOct 24, 2022 ·29 revisions
A userscript that adds a header that can toggle long code and quote blocks in comments
- The block header:
- Allows the toggling of the long code & quote block views.
- Includes the code language based on the syntax highlighting class name; if highlighting is not applied, "Block" is used as the default name.
- Includes the number of lines within the block.
- Click the header to toggle the view of the content immediately below the header.
- UseShift + Click to toggle all the view of all blocks within the same issue comment.
- UseShift + (Ctrl or⌘) + Click to toggle all blocks on the page.
- Can be used along with theGitHub-collapse-markdown userscript.
- Use the userscript addon to change these settings (see screenshot below):
- "Set GitHub Collapse in Comment Max Lines" to the number of lines within a block needed to add a header (set to
10by default). - "Set GitHub Collapse in Comment Initial State" to
expandedto not have the blocks initially collapsed (collapsedby default). - After changing either option, make sure to reload the page (Shift +F5) to have the updated setting take effect.
- "Set GitHub Collapse in Comment Max Lines" to the number of lines within a block needed to add a header (set to
- Clickthis link to install from GitHub; or, install fromGreasyFork orOpenUserJS.
- Or, you can install it as a browser addon. Check outOctopatcher!

- Update dependencies
- Update mutation script.
- Update mutation script.
- Update GitHub icon.
- Update mutation script.
- Update mutation script.
- Support Cmd + Shift + Click for Macs.
- Update mutation script.
- Update mutation script.
- Update mutation script url.
- Extract syntax type from class name.
- Update assets.
- Update mutation script url.
- Change license to MIT.
- Update mutation url.
- Switch to using mutations.js.
- Use pjax & preview events.
- Clean up "closest" function.
- Use
classListtoggle.
- Show current state when changing option. Seeissue #12.
- Change initial state choices to "collapsed" or "expanded". Seeissue #12.
- Beautify.
- Improve accessibility of header.
- Fix squished collapsed arrow.
- Initial commit.