20

At the moment, backtick markdown elements are rendered with a grey background. This can get a little jarring when used frequently, for example:

I have a table Widgets with columns, WidgetID, Name, Quantity, Frequency, BananaType, and UnitCost. I want to SUM the Quantity for each Name and produce a 3-week rolling AVG with a PARTITION BY Name ordered by BananaType DESC and WidgetID ASC. The problem is...

When I type the same thing in chat, it is rendered in a monospaced font, without the dark background:

Chat capture

Don't get too hung up on how to format the example above - the question I am asking here is:

Would you prefer it if backtick (in-line code) rendering for our site only did not have the grey background?

There is a yes and no answer. Please only upvote the option you agree with.

This question is limited to code in mixed paragraphs (as shown above).
Code block rendering like the following is not affected:

    CREATE TABLE Widget
    (
        WidgetId   FOO NOT NULL,
        Name       BAR NOT NULL,
        Quantity   FOO NOT NULL,
        Frequency  BAR NOT NULL,
        BananaType FOO NOT NULL,
        UnitCost   BAR NOT NULL,
        CONSTRAINT PK_Widget      PRIMARY KEY (WidgetId),
        CONSTRAINT AK_Widget_Name UNIQUE      (Name)
    )
3
  • 2
    Not sure if this should be a comment or an answer (not sure what capabilities exist to affect the system), but: it's too bad that there isn't a free-form field (or even a drop-down or something) in each user's "Preferences" for "backtick markdown format" such that there was no need for debate about which style was better / nicer. Yes, there are issues with this approach, but the system already parses for "allowed" HTML so no huge risk. Default could be the current style, but then can be adjusted by folks who don't like it ;-). But I assume this requires code changes by Stack Exchange so no go. Commented May 26, 2016 at 20:30
  • 1
    I would like this as an optional formatting choice in addition to the backticks. Maybe through <tt>
    – user1822
    Commented Jun 3, 2016 at 22:31
  • 1
    I'd personally like a bit more syntax highlighting within the blocks of code (which, as you mentioned, is not the point of this metapost). Currently it's black plus keywords in blue and occasional red (tables). Not sure how exactly to improve it, but there's got to be an upgrade somewhere
    – mpag
    Commented Jun 17, 2016 at 20:39

3 Answers 3

24

No - it is just fine as it is.

Example

1
  • 4
    I don't really see a need to change it. People will abuse formatting options but that doesn't mean we should make the distinction less clear for the times it is helpful. I've probably abused this in the past, but I like how the gray really highlights the important bits of code. When I was more active this was really helpful for me to quickly locate and pull out column names while formulating an answer.
    – Erik
    Commented May 28, 2016 at 16:29
21

It is jarring, but taking the background colour away entirely leaves it hard to tell what is code and what isn't:

enter image description here

I think we should consider a third option, ether a lighter grey:

enter image description here

Or something else:

enter image description here

Just for reference, this is what we currently have:

enter image description here

10
  • 2
    Thanks for posting this as I was wondering the best way to express this in terms of the 2 options presented (I am very pro tri-state Booleans ;-). Something similar to using <kbd>text</kbd> to provide some amount of distinction that is less harsh than the current, but not as muted as the proposed "yes" option. Commented May 25, 2016 at 18:01
  • 2
    Personally, I think the monospace font alone is just fine. Seems to work well in most technical books I own.
    – Paul White Mod
    Commented May 25, 2016 at 18:04
  • 3
    @PaulWhite Monospace font alone is certainly better than nothing, and yes, in print it seems to work out ok, but on screen, it just seems a little too close to the regular font. It is certainly distinguishable, just not nearly as quick and easy to distinguish. So if truly there is no "other" option here, I would pick "No", even though I agree with your initial assessment that the current grey background is a little jarring when used repetitively in a small area. Commented May 25, 2016 at 18:12
  • 1
    @PaulWhite I understand your not wanting 1000 proposed options here, but I should mention that a slight variation on the proposed change, such as monospace with white background but slightly different foreground, would likely be enough of a distinction. That minutia can wait for a follow-up question, of course, but just to give a sense of why I have a hard time voting for either "Yes" or "No" here :-). Commented May 25, 2016 at 18:17
  • 3
    Perhaps it depends on the font settings, although personal perception may play a role too. I have no issues distinguishing the code bits when needed (and when not needed, there's no distraction reading the post as a whole). Here's what I get after removing the background: i.imgur.com/dWpWrBV.png I think retaining the padding should be helping too.
    – Andriy M
    Commented May 25, 2016 at 18:18
  • 1
    @srutzky You could also comment on the yes or no option if you like. For me, the distinction between inline code and text is not that important or useful anyway. That said, monospace alone is a pretty clear difference here (my screen, my browser, my eyes). There might well be a follow-up if the consensus is for change, yes.
    – Paul White Mod
    Commented May 25, 2016 at 18:19
  • 3
    @PaulWhite Re: commenting on either the "Yes" or "No" answers, that's really a short answer: "Yes" with an "If," long answer: "No" with a "But." situation ;-) Commented May 25, 2016 at 18:52
  • 3
    @AndriyM I agree, retaining the padding while taking away the background would make the formatting better. As Paul mentioned in his comment above, this is the kind of formatting I also see in most technical books or documentation. But, as you also brought up, personal perception/preference plays a very important role in this situations. Perhaps the perspective of a graphic designer could enrich the discussion.
    – MDCCL
    Commented May 26, 2016 at 15:00
  • 5
    @PaulWhite I'm in the process of selling my house and moving so all my technical books are packed up at the moment. That being said I personally think that is a bit of a straw-man. Paper looks the same to everyone, but monitors are all over the place. One of my monitors shows the highlighting 2+ shades lighter than another. Plus book typesetters play with font weight and other variables to make the distinction clear. I think Jack's "or something else" option is the best if we're going to change the status quo. On my good monitor I can't tell the difference between the first two samples.
    – Erik
    Commented May 28, 2016 at 16:20
  • 4
    Preferably not a lighter gray. (I can't see it on my monitors at work.) Personally a fan of border + monospace.
    – 0b10011
    Commented Jun 1, 2016 at 20:44
11

Yes I would prefer this to be rendered with a monospace font only (no grey background).

Example

Without the CAPS/TitleCase it looks like this:

Example

0

You must log in to answer this question.

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