45

I had problems posting an answer as it was misidentified as code. When trying to post I received the following error message:

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

I was able to get the site to accept my answer by removing most of the reference style links.

Here is the source I originally tried, which was rejected:

A far as I'm aware, there is no 'official' media type for brainfuck ([Official types listed here][mimetypes]). You are of course free to make up your own without officially registering the type, but you should take a few things into consideration before choosing what name to use. All the information you need is in [RFC2046][rfc2046]. I'll discuss the relevant parts below.

# Top Level Media Type

As far as I can see, the two options you might choose from are `text` and `application`:

## `text`

According to [Section 3][rfc2046-3]:

> The subtype "plain" in particular indicates plain text containing no formatting commands or directives of any sort. Plain text is intended to be displayed "as-is". No special software is required to get the full meaning of the text, aside from support for the indicated character set.

If you intend for the data to be displayed rather than interpreted by an application, I would use this.

[Section 4.1.4][rfc2046-4-1-4] mentions the following about unrecognised subtypes:

> Unrecognized subtypes of "text" should be treated as subtype "plain" as long as the MIME implementation knows how to handle the charset.

Setting your top level media type to text will ensure that compliant applications that do not recognise the full type will still render the data as text.

## `application`

If you intend your data to be interpreted or processed further, you should use the application top-level media type. As in the argument above, if you label your data as `application`, any programs that receive it are more likely to behave in a sensible fashion.

[Section 4.5.3][rfc2046-4-5-3] deals with unrecognised application types:

> It is expected that many other subtypes of "application" will be defined in the future.  MIME implementations must at a minimum treat any unrecognized subtypes as being equivalent to "application/octet-stream".

Reading the appropriate section ([Section 4.5.1][rfc2046-4-5-1]) we find out how applications are supposed to handle octet streams:

> The recommended action for an implementation that receives an "application/octet-stream" entity is to simply offer to put the data in a file, with any Content-Transfer-Encoding undone, or perhaps to use it as input to a user-specified process.

If this seems like the most logical way to handle your data when it is unrecognised, then `application` is for you.

# Sub-type

Choosing the subtype is much easier. [Section 6][rfc2046-6] covers experimental media types:

> A media type value beginning with the characters "X-" is a private value, to be used by consenting systems by mutual agreement.  Any format without a rigorous and public definition must be named with an "X-" prefix, and publicly specified values shall never begin with "X-".

So your subtype should be `X-brainfuck`.

# Summary

You have two options:

 1. `text/X-brainfuck`
 2. `application/X-brainfuck`

If you intend for applications to treat the data as plain text and display it, choose 1. If you intend the data to be interpreted or executed, choose 2. If you're unsure what you want to happen, choose 2, because the default expectation is that an application will prompt the user for what to do if it does not recognise the type.

  [mimetypes]: http://www.iana.org/assignments/media-types/media-types.xhtml
  [rfc2046]: http://tools.ietf.org/html/rfc2046
  [rfc2046-3]: http://tools.ietf.org/html/rfc2046#section-3
  [rfc2046-4-1-4]: http://tools.ietf.org/html/rfc2046#section-4.1.4
  [rfc2046-4-5-3]: http://tools.ietf.org/html/rfc2046#section-4.5.3
  [rfc2046-4-5-1]: http://tools.ietf.org/html/rfc2046#section-4.5.1
  [rfc2046-6]: http://tools.ietf.org/html/rfc2046#section-6

Here is the source that was accepted:

A far as I'm aware, there is no 'official' media type for brainfuck ([Official types listed here](http://www.iana.org/assignments/media-types/media-types.xhtml)). You are of course free to make up your own without officially registering the type, but you should take a few things into consideration before choosing what name to use. All the information you need is in [RFC2046][rfc2046]. I'll discuss the relevant parts below.

# Top Level Media Type

As far as I can see, the two options you might choose from are `text` and `application`:

## `text`

According to [Section 3](http://tools.ietf.org/html/rfc2046#section-3)):

> The subtype "plain" in particular indicates plain text containing no formatting commands or directives of any sort. Plain text is intended to be displayed "as-is". No special software is required to get the full meaning of the text, aside from support for the indicated character set.

If you intend for the data to be displayed rather than interpreted by an application, I would use this.

[Section 4.1.4](http://tools.ietf.org/html/rfc2046#section-4.1.4) mentions the following about unrecognised subtypes:

> Unrecognized subtypes of "text" should be treated as subtype "plain" as long as the MIME implementation knows how to handle the charset.

Setting your top level media type to text will ensure that compliant applications that do not recognise the full type will still render the data as text.

## `application`

If you intend your data to be interpreted or processed further, you should use the application top-level media type. As in the argument above, if you label your data as `application`, any programs that receive it are more likely to behave in a sensible fashion.

[Section 4.5.3](http://tools.ietf.org/html/rfc2046#section-4.5.3) deals with unrecognised application types:

> It is expected that many other subtypes of "application" will be defined in the future.  MIME implementations must at a minimum treat any unrecognized subtypes as being equivalent to "application/octet-stream".

Reading the appropriate section ([Section 4.5.1](http://tools.ietf.org/html/rfc2046#section-4.5.1)) we find out how applications are supposed to handle octet streams:

> The recommended action for an implementation that receives an "application/octet-stream" entity is to simply offer to put the data in a file, with any Content-Transfer-Encoding undone, or perhaps to use it as input to a user-specified process.

If this seems like the most logical way to handle your data when it is unrecognised, then `application` is for you.

# Sub-type

Choosing the subtype is much easier. [Section 6](http://tools.ietf.org/html/rfc2046#section-6) covers experimental media types:

> A media type value beginning with the characters "X-" is a private value, to be used by consenting systems by mutual agreement.  Any format without a rigorous and public definition must be named with an "X-" prefix, and publicly specified values shall never begin with "X-".

So your subtype should be `X-brainfuck`.

# Summary

You have two options:

 1. `text/X-brainfuck`
 2. `application/X-brainfuck`

If you intend for applications to treat the data as plain text and display it, choose 1. If you intend the data to be interpreted or executed, choose 2. If you're unsure what you want to happen, choose 2, because the default expectation is that an application will prompt the user for what to do if it does not recognise the type.

[rfc2046]: http://tools.ietf.org/html/rfc2046

After posting, I tried editing the reference style links back in one at a time.

Extending the list of links with the following worked fine:

[rfc2046-3]: http://tools.ietf.org/html/rfc2046#section-3

This one did not work:

[rfc2046-4-1-4]: http://tools.ietf.org/html/rfc2046#section-4.1.4

I've tagged this both a bug and a feature-request because:

  • My answer was misidentified as containing unformatted code when it did not.
  • If false positives are inevitable, I'd like to request that the site still allow you to post after prompting you to check for unformatted code. Having the user tick a box to confirm they rechecked their post might be enough to still reduce missing code formatting.
11
  • 2
    As an added note, here's another case of misidentification.
    – user4266696
    Commented Nov 26, 2014 at 5:57
  • 2
    Would CommonMark-support fix this?
    – Anko
    Commented Nov 26, 2014 at 20:55
  • 13
    What's funny is I see broken code samples all the time so I didn't even know this feature existed! Commented Nov 27, 2014 at 8:23
  • 2
    @misterManSam I think it's a new feature, and it clearly still has some bugs to work out. The algorithm could probably be adapted to avoid this specific issue, but I like the suggestion of having a way for a user to over-ride the warning. I don't think anyone is posting badly-formatted code on purpose, so just warning about it -- and explaining how to fix it -- should be enough.
    – AmeliaBR
    Commented Nov 27, 2014 at 20:50
  • 1
    @AmeliaBR: That pre-supposes that users care about conforming to expectations in any way. Far too many only care about getting their own personalized answer yesterday already, and will just click-through. (Some of those even add gibberish to jump those hurdles.) Commented Nov 28, 2014 at 2:18
  • 1
    @Deduplicator As long as users understand that good formatting increases the likelihood that someone will answer, it will be in their interest to spend a few seconds correcting themselves. If someone decides to shoot themselves in the foot, then their fair reward is a lack of interest in their question, and perhaps some down-votes.
    – user4266696
    Commented Nov 28, 2014 at 10:00
  • @curiousinternals: Sure. I'm mostly challenging the blithe assumption (which is oft-disproved) that users will read anything, and spend and more time than they are forced to, in many cases. And in general those get the downvotes and close-votes they asked for, though often they get their answer anyway, which means they won't care. Of course there are also good people. Commented Nov 28, 2014 at 20:19
  • @Deduplicator Agreed. Once I was asked for assistance by a friend and I directed them to read a particular line in a lab manual they were meant to have read. They read half the line out loud and I had to prompt them again to read the entire line, which solved their problem. We had a good laugh about that one. That happens far too often though. Sometimes I think it might be worth employing an artist to get across the most critical information. It's been my experience that images get ignored less.
    – user4266696
    Commented Nov 29, 2014 at 0:35
  • Re: "As long as users understand that good formatting increases the likelihood that someone will answer, it will be in their interest to spend a few seconds correcting themselves." It is fairly obvious that formulating a decent on-topic question increases the likelihood that someone will answer, yet that rarely happens anymore.
    – user4639281
    Commented Jan 11, 2017 at 21:40
  • it would be great to add a 60 seconds counter and provide an override button after that time. i had the same problem but i did not fixed it by inlineing but by separating the bib-lines ..
    – Summer-Sky
    Commented Jan 22, 2017 at 23:06
  • The solution here is to not ask questions or make posts here about a joke language.
    – TylerH
    Commented Aug 2, 2023 at 19:03

1 Answer 1

6

Original post is Nov'14 and I'm having similar problem in 2017! I totally agree that this is definitely a Bug. Link that cost me few hours to figure how to properly mark code in my post. I still do not understand why it didn't work in all possible ways posted in Mark Help. My solution was simply mark it in plain HTML.<a href="https://codeyarns.com/2015/03/18/how-to-check-colors-supported-by-terminal">terminal colors</a>

2

You must log in to answer this question.