-3

I feel I have written a very long code block in a question which I'd like to be able to toggle - is there a possibility to toggle these longer blocks (I do not mean to run the snippet inside!).

3
  • 1
    What do you mean by toggle - it's not formatting/unformatting it as code, is it?
    – Glorfindel
    Jun 15, 2016 at 7:58
  • 1
    @Glorfindel, I think he means collapsible spoiler, like code snippets have option "Hide snippet by default".
    – Qwertiy
    Jun 15, 2016 at 9:46
  • @Qwertiy: Exactly.
    – Jan
    Jun 15, 2016 at 10:15

1 Answer 1

2

I fully support the idea of collapsible spoilers, but I don't think it should be used in example from this question.

On metaRuSO I shown a few better examples where spoilers are needed.

Sorry, but most part of my examples is in Russian as I'm more active there. I'll try to explain the idea.

  • Replacement results should be under spoilers (in Russian)

    Each header "Замена #" is followed by 2 lines of code explaining what replacement should be used in Notepad++. After these lines a large portion of text goes - it's the result of replacement. It's useful to check if you are doing things right, but it is extra for understanding answer idea, so I'd like to move it into spoiler.

  • Snippet is used as a spoiler (in English)

    The required code fragment is already shown in the question, but I fell it would be good to add the whole function code too. As it is JavaScript, the snippet is OK for such role, but even in that case I have to write "(snippet is used to make collapsible spoiler, it's not for running the code)".

  • Command execution results should be under spoilers (in Russian)

Same idea as in the first example: Commands are parts of the solution, but their output is added just to show data format and transformations. No need to have them expanded by default.

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