Typing Literal Tab Characters

I do not know how feasible this is, for the developers, but I do believe, that at least on this site, it may make more sense to stop expanding tabs into four spaces.

If the browser side code can be made to render tabs as four spaces, this issue is moot. Some code golf answers (or input samples) require a literal tab in the source and there should be a way to indicate that.

I am not a web developer, so I may be clueless, but I will put this up for a feature request and take any flak downvotes.

This is not intended to incite any tabs versus space wars.

Wow! This post seems to have garnered a significant community consensus. As such, I have put this up for a network wide feature request here!

  • 20
    \$\begingroup\$ Code golf or not, whitespace is significant in some languages (notably Python), and replacing tabs with spaces could.break the code. If we can get a site-specific exception for this, it should apply to all control characters (with the obvious exception of NUL). \$\endgroup\$
    – Dennis
    Sep 7, 2016 at 23:37
  • 4
    \$\begingroup\$ Yes, this is a fantastic idea! I also am not a Web Dev, but dear SE, can we please see unprintable characters too? \$\endgroup\$
    – DJMcMayhem
    Sep 8, 2016 at 0:07
  • 3
    \$\begingroup\$ this would probably be a fairly easy userscript to write, i can look into it later if i'm not busy. it would replace any set of four continuous spaces though, which would break at least one of my answers on this site, but the spaces/tabs issue is far more pressing \$\endgroup\$ Sep 8, 2016 at 0:12
  • 8
    \$\begingroup\$ AFAIK this can be quite a problem for Python answers which mix tabs and spaces for saving bytes \$\endgroup\$
    – Downgoat
    Sep 8, 2016 at 0:40
  • 3
    \$\begingroup\$ @Dennis Why not NUL? \$\endgroup\$
    – jimmy23013
    Sep 8, 2016 at 2:07
  • 1
    \$\begingroup\$ @jimmy23013 A literal NUL is a parse error, but I'm not sure about escapes. It can create problems for copy-pasting though. \$\endgroup\$
    – Dennis
    Sep 8, 2016 at 2:16
  • 3
    \$\begingroup\$ Given the Python requirements, it seems like this might be an issue for Code Review as well. I see this thread discussing a bookmarklet workaround, but my minimal searching hasn't yielded anything else. \$\endgroup\$ Sep 8, 2016 at 12:43
  • 3
    \$\begingroup\$ @undergroundmonorail I'm afraid there is no userscript which can be made, because the tabs are gone server-side :( \$\endgroup\$ Sep 9, 2016 at 11:39
  • 7
    \$\begingroup\$ @undergroundmonorail Poor Whitespace... \$\endgroup\$ Sep 9, 2016 at 15:37
  • 1
    \$\begingroup\$ We could always scrape the post source... \$\endgroup\$
    – wizzwizz4
    Sep 14, 2016 at 16:34
  • 1
    \$\begingroup\$ Could we please get an official response on this? Is there a protocol to directly reach out to a community dev and get this either approved or rejected? \$\endgroup\$ Sep 14, 2016 at 22:38
  • 1
    \$\begingroup\$ @RohanJhunjhunwala Unfortunately there is not. You could post a feature request on meta.se and link them back here. \$\endgroup\$
    – DJMcMayhem
    Sep 15, 2016 at 2:34
  • 2
    \$\begingroup\$ @wizzwizz4 I'm pretty sure that tabs and other unprintables are never even stored server-side. \$\endgroup\$ Sep 16, 2016 at 7:38
  • 2
    \$\begingroup\$ Perhaps should we ask for an "upload" button so we can send the code via a file and have it displayed. \$\endgroup\$
    – Emmanuel
    Sep 16, 2016 at 13:33
  • 1
    \$\begingroup\$ @DJMcMayhem I will attempt that if this continues for a bit more with no official response. The more upvotes I show when I take to mother meta, the better. Conversely if there is some dissent to this idea, I wish to give an opportunity for someone to downvote and/or commentabout why this is not a good idea. \$\endgroup\$ Sep 16, 2016 at 20:16

1 Answer 1


As per this feature request: Stop expanding tabs into four spaces


Note that this only works if you put the code within a <pre><code> block, which means you also have to escape < with &lt; (and & with &amp; in certain cases), so it's still annoying, but if you do a find/replace on your code, you can make it work.

If you really need to display tabs correctly, this workaround helps.

  • \$\begingroup\$ It has been decided that this workaround will be the only way because the feature request was declined. \$\endgroup\$ Apr 15, 2018 at 0:39

You must log in to answer this question.

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