-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapsible contents (code block) in comments / spoiler tag #166
Comments
In case you're interested, I just created a userscript to collapse code & long quote blocks in comments. |
@Mottie That is fantastic! That is exactly what I'm looking for. Any chance you could turn that into Chrome Extension so that it could be synced across browsers? |
That shouldn't be a problem, but what do you mean by "synced across browsers"? |
If you setup your Google account on Google Chrome, it can sync extensions and settings between different instances of Google Chrome (laptop, desktop, chromebook, etc.) |
Oh, you can do that with Tampermonkey's TESLA. And now that I think about, it might be a bit more painful than I initially thought. If I make more than one addon, I'll need to move each userscript into its own subdirectory with a manifest.json. That might take a bit longer. |
Ok, I finally got around to creating a Chrome extension. Enjoy! |
@ide The |
Firefox v49 is now live (since yesterday)! |
Building on @ide's answer, here's how to handle code blocks inside The key is to wrap the whole contents inside the
For more details see: http://stackoverflow.com/a/39920717/253468 |
Though not directly related to this discussion, I just published a handy new Chrome extension that enables code-folding when viewing files in GitHub and I hope many people find it as useful as I do. Works for any indentation style - tabs, 2 spaces, 4 spaces, etc. https://github.com/noam3127/github-code-folding |
Click to expandwhatever |
Search not, future seekers. Close issue? |
@caseydwayne I object to closing, I don't think of |
How to format code inside the collapsed block? Tried the Summary```js const x = 1 ```
|
@brunolemos Add an extra line break before the tics. From this:
To this:
In action: Summaryconst x = 1 |
@scottrigby Awesome! Thanks. |
can I make summary tittle bigger? |
You can try
|
Any news on this? I found this issue on an SO answer after reading through the long crash report comment on this issue VSCodium/vscodium#358. Would be really useful to be able to collapse ALL comments similarly how you can on Reddit. |
How can I use checkmarks inside spoiler? This is a checkmark:
Where However inside the spoiler, toggling state will collapse the spoiler..! Open me and check three marks!
This is especially troublesome in longer spoilers than I showed above. |
Hello! I want to make the name of the spoiler as a link, how do you think such an entry in markdown is correct?
|
<details>
<summary><a href="#chapter_1">Chapter 1</a></summary>
* [Chapter 1.1](#chapter_1_1)
* [Chapter 1.2](#chaper_1_2)
</details> |
@Berchon maybe try a different browser? I think |
@Berchon what does "doesn't work" mean in your case? I tried Android Chrome and it was hard to expand because we can't click on the link or the arrow, only on the right side of the line. After that it jumps to heading as expected. I guess adding more (unlinked) text would make this better. Note: the empty line after summary and before details is sometimes very important. |
@ide and @TWiStErRob thanks for your practical solutions!
|
Am I having these problems any solution? |
Is there any shortcut / autocomplete / button to spawn a |
@a-pav The Refined GitHub browser extension adds a button to do just that: |
Works without any extension whatsoever: Click to expand<details>
<summary>Click to expand</summary>
```html
<h1>Hello world</h1>
<h2>This is me</h2>
```
</details> Note that you need to leave an addtitional newline around the code block Here's a gist |
@PieterjanDeClippel yes it does. The point in recent conversations is that a UI interaction is better than manual typing/Google-copy-paste, an interaction would ideally take care of annoyances like remembering to insert those new lines. |
Related: #154, isaacs/github#208
GitHub really needs a way to collapse long contents. Being able to collapse entire comments may suffice for most. To me however, the ideal solution would be to collapse any code block with more than 10 lines (or whatever number) by default. The code block would be replaced by the text:
Code (130 lines) - Expand
Where clicking "Expand" reveals the code block. Being able to specify a collapsible code block with ````collapse` would work equally as well. I recall reading a discussion about this feature involving some GitHub developers. I can't find the link to that discussion, but their response at the time was "We'll implement it when CommonMark does."
Here's the CommonMark discussion: http://talk.commonmark.org/t/what-could-a-spoiler-tag-extension-look-like/767
The GitHub Markdown guide hasn't been updated in over 2 years: https://guides.github.com/features/mastering-markdown/
Perhaps it's time to stop waiting for CommonMark to change and simply add this functionality to GitHub's Web UI; no MarkDown hacks required.
The text was updated successfully, but these errors were encountered: