I'm currently accessing Stack Overflow through the mobile site (on a phone), and I tried without joy to insert a code block. (seemingly, I'm not the only one who has had this problem)

I tried to put 4 spaces before and after the code. This is not working.

Please be more clear in your explaination or add simple [code] or [quote] markup that would be more logical.

  • 1
    4 spaces before each line and a line break before thw ehole block should be used. there's no need to suffice 4 spaces. – Rob W Jul 12 '12 at 20:45
  • Thanks for your reply but what if my code is 40 lignes long? – JinSnow Jul 12 '12 at 20:53
  • 5
    Good luck tapping 161 times (alternatively, you could just post your unformatted code, with a note in which you mention that you're using a mobile device which is uncapable of indenting code. Most users (well, at least me) would edit your post and format it for you). – Rob W Jul 12 '12 at 20:58
  • A bug? Seriously? – Arjan Jul 12 '12 at 21:01
  • You are good in mathematic and a nice person... Unfortunately, stackover do not let me post a ppost with a code if it hasn t been quote properly... – JinSnow Jul 12 '12 at 21:03
  • 2
    @user1486850 Slide to the bottom of the page, then tap "Full site". You should see the full Markdown editor, which can be used to indent code. A last resort, which should actually not be used, is to paste code at an external (but reliable!) host, such as pastebin.com. 40 lines of code is quite much, by the way. Are you sure that it cannot be stripped down to, say, 5 lines? – Rob W Jul 12 '12 at 21:20
  • 2
    I can understand posting code in an answer from mobile (I do it all the time, it's quite difficult) but I don't understand why you'd post a question? If you've got 40 lines of code you've a problem with, surely better to post the question from your coding machine? You're not going to manually type 40 lines without introducing errors in your question. – jrturton Jul 13 '12 at 6:10

One easy way to insert a code block is to highlight your code and click the curly braces button in the editing bar (the ones that look like "{ }"). This should automatically format your code into a codeblock.

  • 4
    Tempted to upvote, but... 404 – Daniel Fischer Jul 12 '12 at 20:48
  • Yeah, @Yawus what were you thinking!?!? – Aaron Bertrand Jul 12 '12 at 20:50
  • @DanielFischer Whew. Dodged a bullet there. – Yawus Jul 12 '12 at 20:50
  • @AaronBertrand Well, that's why I want that reputation lock! That way, I can satisfy my addiction to Q&A without possibly increasing my reputation! – Yawus Jul 12 '12 at 20:51
  • 1
    Well I m connecting with a phone so there is no bracket on it. And well I use the "full website" it doesn t work with the phone (I tried...) but thanks! – Giom 19 mins ago ! – JinSnow Jul 12 '12 at 20:51
  • Ah. Your message wasn't exactly clear about you being on the mobile site. In that case, you should probably follow Rob W's suggestion. – Yawus Jul 12 '12 at 20:52
  • @Giom on your phone you can still enter 4 spaces and a carriage return, or surround the code with backticks - ` – Aaron Bertrand Jul 12 '12 at 20:53
  • 2
    Or, you know, don't try to enter code on the mobile site. – Ernest Friedman-Hill Jul 12 '12 at 20:55
  • @ErnestFriedman-Hill yes, that is probably true too. – Aaron Bertrand Jul 12 '12 at 21:00
  • True wasn't clear i apologize. So you suggest me to use the fulll site? – JinSnow Jul 12 '12 at 21:05
  • @user1486850 If you want to post code blocks (I'd say 10+ lines), then yes. If you can get by with in-line code (surround with backticks `), then you should be fine. Although, I'm not sure if you can access a backtick from a phone. – Yawus Jul 12 '12 at 21:06
  • @Yawus you can on an iPhone and iPad, but it's a cumbersome PITA, made even more so by AutoMangle. – Aaron Bertrand Jul 12 '12 at 21:26
  • This person needs 20 downvotes to get back to 404. Let's get started before it's too late! – Pëkka Jul 12 '12 at 22:12
  • (That real downvote is not mine, though...) – Pëkka Jul 12 '12 at 22:12
  • He he, what that a 404 error? Guys you are making jokes but it is a matter of life or death don't you see? Have a good day! Haha – JinSnow Jul 13 '12 at 14:36

Well apparently I need to put spaces before all my code lines... Since the ``` doesn't works for more than a single Line (the full website brackets doesnt work with iPhone . And I learned about 404 error downvote things ... Actually what I was looking for is a combination of pre and code ... HTML tag.

Thanks a lot for all your dynamic replies!

UPDATE : the code and dev doesn't work for few lines. It is very complicate with a mobile...

You must log in to answer this question.

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