3

I know in the question's body, we can use `code` to specify inline code like this.

But can we specify code in the title of the question? And if not, why?

4
  • 7
    No formatting is allowed in the title to avoid issues with people trying to make their titles stand out above the others. It would be a sea of My super big important problem .... While moderation works for all-caps titles, style choices would be more argued over. This includes the code tag. Further, we want titles to reflect the question being asked, not the code being exhibited. If you can't convert the code snippet into a suitable english title, you probably need to study the problem more before posting a question about it.
    – Pollyanna
    Mar 12, 2012 at 5:08
  • Do you mean code means program code or highlighting something? Mar 12, 2012 at 5:15
  • 1
    There shouldn't be enough code in question titles for this to ever matter. If there is, you've written a bad title. Mar 12, 2012 at 7:48
  • @Cody: Before I learned that it didn't work, I had taken the time to edit posts asking about gettimeofday(2) or other standard functions to include code formatting in the title. (Until a kind moderator fixed my mistake and told me about it..) Since then I've been the one to tell several others. It's always a bit of a surprise...
    – sarnold
    Mar 12, 2012 at 7:51

1 Answer 1

8

No, Markdown isn't run on the title whatsoever. Any special characters get converted to their entities. There's really no need to specify code in the title. If you're using too much code in the title, perhaps you should consider a better title. Normally we'd only see someFunction() or Some_Random_Class listed in the title, which is perfectly readable for the short amount of text present for that line. Inline code in posts is meant to make the code stand out more than anything.

In the body:
It's pretty hard to see those specific functions and classes in that huge block of text above without reading through it. Also, small code snippets such as i + 3 == true would be difficult to spot or even comprehend. The inline code makes it stand out in that you see the formatted box and realize you're starting a piece of code, and that this block of text should be taken as a whole rather than as part of the sentence around it.

In the title:
The text is a lot bigger and limited in size, making it easy to find functions or classes it might be about.

It's pretty easy to determine someFunction() is a keyword in this title, yes?

3
  • I think OP is talking about highlighting question titles. Mar 12, 2012 at 5:14
  • 1
    @Somnath: Inline code (or "highlighting") is part of Markdown, and I've explained why it isn't necessary in titles.
    – animuson StaffMod
    Mar 12, 2012 at 5:15
  • Inline code snippets have nothing to do with highlighting and should not be used that way. Mar 12, 2012 at 7:48

You must log in to answer this question.

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