This question already has an answer here:
Usually when I write an answer I explain each section of my code separately and then add a link to a JSFiddle demo at the end. For example take a look at this answer on StackOverflow:
Now with the introduction of stack snippets I would like to replace my JSFiddle links with stack snippets. However it seems that you cannot split your stack snippets into multiple sections.
It would be nice if this were possible. It would be even better if you could arrange the sections in any order. The order in which the snippets should be rearranged could be specified in the
language comment. For example:
<!-- language: lang-js snippet: 2 --> <!-- language: lang-js snippet: 1 --> <!-- language: lang-js snippet: 3 -->
Currently the only other way I can split my code into multiple sections and use stack snippets is to duplicate the code (and rearrange and merge the sections) into a stack snippet at the end of the answer, which is okay: I can say “Here is the code put together.”
However this method has the disadvantage that if I change some code in my section then I need to make the same change in my stack snippet. It would be nice if I only needed to make the change in one place.