4

I am not sure if this is something which would be beneficial to other sites which handle blocks of formatted text, but for sites like CS50.SE and others, it would be good if there could be a special spoiler tag which supports wrapping a block of formatted text in a spoiler without ruining the formatting.

Has this been considered and is it doable on the network side, or possibly just for the CS50 at least? This would help with Academic Honesty and not ruining the joy of learning for those who are looking for help, but want to be challenged as well to not just read through the answer.

  • This is a great idea! – hotwebmatter Jul 29 '17 at 23:02
5

Source:

>! <pre><code>#include <stdio.h>
>! 
>! int main(void)
>! {
>!     printf("Hello, world!\n");
>! 
>!     return 0;
>! }</pre></code>

Result:

#include 
 
 int main(void)
 {
     printf("Hello, world!\n");
 
     return 0;
 }

You do lose the nice colors of the formatting though...

  • 1
    That is what I was thinking. A way to keep the colors and such but just make it spoiler friendly... – ben-Nabiy Derush Jul 19 '17 at 19:03
  • 1
    And this is a great Markdown hack which solves most of the problem. I do note that #include <stdio.h> loses the <stdio.h> (presumably because the angle brackets are mistakenly identified as HTML markup). I wonder how much work it would really be to implement a similar mouseover fade-in effect that preserves the syntax highlighting and such. – hotwebmatter Jul 29 '17 at 23:03
  • It would be rough if you had to do that to 150 lines of code though... – ben-Nabiy Derush Jul 30 '17 at 13:58
1

I tried to explicitly force a specific language for the highlighting, in the main site, and it seems to work, at least in the preview.

screenshot

I didn't post an answer, since I didn't have one to write, so I cannot say if it works also when the post is saved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .