I often format answers something like
Do this
var a = b * c;
Then do this
log("the answer is " + a);
Is it possible to pull those lines separately out of a snippet of say 10 lines to include in the answer?
For example maybe the full snippet is
var log = function(msg) {
var div = document.createElement("div");
div.appendChild(document.createTextnode(msg));
document.body.appendChild(div);
};
var b = 12;
var c = 34;
var a = b * c;
log("the answer is " + a);
It might be really nice to be able to mark up the snippet and then insert it in parts into the answer like maybe the snippet might look like this
var log = function(msg) {
var div = document.createElement("div");
div.appendChild(document.createTextnode(msg));
document.body.appendChild(div);
};
var b = 12;
var c = 34;
<!-- snippet#abc -->
var a = b * c;
<!-- snippet#answer -->
log("the answer is " + a);
<!-- snippit#end -->
And the markdown might look something like
Do this
![snippit#abc]
Then do this
![snippit#answer]
...full snippet source down here...
Thoughts? Seems like it would be very D.R.Y. and less error prone. You wouldn't have to fix two places if you come back and make an edit to the code.