4

Background

A lot of the time I will have code that is relevant towards solving a problem, but including it with my question tends to make the question look cluttered. This is really common when working with web frameworks. If I have too many pieces of code, I like to put them in code snippets for a few reasons which include

  1. The question looks neater
  2. The question looks less overwhelming and drives less potential answerers away.
  3. Some configuration files (e.g. webpack.config.js) can provide helpful information to the person answering, but really aren't the bulk of the question and shouldn't really be grabbing the attention of everyone reading the question.

Feature Requests

I think these features would help make posts look even less cluttered

1. Optional Run Code Snippet button

  • Problem: These snippets always have the Run Code Snippet button at the bottom, but not all of them are meant to be run and running them will just produce an error(especially since the code snippets only allow certain languages)

  • Solution: I think there should be an option to remove this button, and maybe move the copy snippet to answer button to smaller version in the corner(as transparent overlay perhaps?).

2. Custom dropdown text

  • Problem: Also these code snippets always have the words Show Code Snippet written beside the arrow. At least to me the blue text with the arrow beside is indicative that clicking it will drop down some content, so

  • Solution: I think it would be better for the person posting to be able to customize the text that goes here, and then someone could change this text to something like the name of the file(e.g. webpack.config.js), or in the example below, to things like Server.java, Client.java ...


Example

Here is an example of a question I've asked which looks like this.


2
  • 3
    Sounds like you're essentially looking for new markup that allows for a block of code to be hidden, without it being a frontend snippet. Makes good sense. Commented Jun 15, 2020 at 23:48
  • @CertainPerformance I agree. I sometimes just want to add some code that's non-essential, so I'd prefer to have it hidden by default. That cannot be done without a snippet. In the past I did use a snippet for code you couldn't run but it was still collapsed. I've received edits that removed such snippets, so I stopped doing this.
    – VLAZ
    Commented Jun 16, 2020 at 12:46

0

You must log in to answer this question.

Browse other questions tagged .