25

Following up on this comment I am proposing and requesting a dedicated markdown style for output. To me the requirements are simple:

  • Monospaced font
  • A background color in manner of but distinct from the code and quote styles

The sooner this is implemented the sooner it can take the place of less elegant alternatives. If necessary the style details can be adjusted in time.


Related:

Probable duplicate:

  • Wouldn't it be nice to have the output highlighted? I don't like to put it in a quote-code combination like you do, but on the other hand providing output as comment in a normal code lacks completely of highlighting. Have you considered to build your own style by playing with e.g. Chrome dev tools and re-using existing SE styles, so that we get a feeling for the matter? Btw, have you seen that for JS code there is a special way to test it right away on StackOverflow? – halirutan Mar 18 '15 at 17:30
  • 1
    @halirutan I would like to emulate the Notebook behavior so that it feels familiar to existing Mathematica users, and by default the output does not receive syntax highlighting. I have not considered building my own style; frankly I don't see the value as I think this is really very simple: give us a code-like output, with or without highlighting, with a background that is other than light gray or yellow. Does this really need to be more complicated than that? – Mr.Wizard Mar 19 '15 at 5:36
  • I guess it becomes a bit more complex in reality. How will you mark the output without mis-using markdown syntax (like it is done with the quote-code comb.)? I guess the answer is through html-annotation. Next question is, will it be a separate box or should output be in some kind related to the input? When it is separate, users might complain about the waste of space (compared with putting output as comment directly in the code). If it is connected, then there is a problem with C&P it back to MMa. I would rather think about this than let SE staff decide it for us. – halirutan Mar 20 '15 at 5:56
  • Do you have any information on how the javascript guys got their dedicated look at the code an run it environment that I linked above? – halirutan Mar 20 '15 at 6:00
  • @halirutan You are obviously putting some thought into this. Thanks. I hope you will post an answer with some of this reasoning. No idea about the Java thing; sorry. – Mr.Wizard Mar 20 '15 at 9:17
  • @halirutan The JavaScript is simply executed by your browser in its own frame. I doubt they will add similar support for proprietary languages like Mathematica. They are called Stack Snippets by the way. – Martin Ender Mar 29 '15 at 23:02
  • 1
    @MartinBüttner I wasn't referring to executing code or how this works for JS. I was only pointing to JS, because they have, beside the normal code block, another way of formatting code which is different from normal code blocks. The reason I was mentioning it is that markdown knows only one kind of code, inline or block, and an additional code output has to be marked differently. One of the few ways is to put a specific html-comment before the output block. – halirutan Mar 30 '15 at 9:05
  • @halirutan markdown can be customized; see for example: Add markdown support for hidden-until-you-click text (aka spoilers) – Mr.Wizard Mar 30 '15 at 13:13
  • 1
    I added an output-citing blockquotes style here. The indentation can also be mimicked with $\ $ `code` . Furthermore I tested using different left border colors (one color, two colors), but didn't like that. Of course it doesn't make a dedicated output style unnecessary, but adds an easy way to test different possibilities by modifying that style file. We really should have an ouput-citing style in addition to a text-citing style. – Karsten 7. Aug 29 '16 at 8:00
  • A combination of both styles looks like this. – Karsten 7. Aug 29 '16 at 8:16
4

A distinctive color scheme is definitely necessary (especially with the recent tendency towards low-contrast...).

At least on the main site the approach of putting code output inside quotes is more distinctive than here on meta:

  • Here's a quote

    containing some code
    

Can anyone actually see that change in gray level??

  • 1
    Yes, I see it.. but my eye has a resolution of 2^16 distinct grey-levels. But honestly, I do see a very slight difference, which is completely useless of course if you just look very quickly at it. – halirutan Mar 20 '15 at 5:38
1

This is my attempt to look further into the point made by blockwave. Let's look at how the following raw text will be formatted.

Text

The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog.  

>The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog.  

Inline code

`Plot[Sin[x], {x, 0, π}]`

>`Plot[Sin[x], {x, 0, π}]`

Block code

    Plot[Sin[x], {x, 0, π}]
    Plot[Sin[x], {x, 0, π}]

>     Plot[Sin[x],{x, 0, π}]
    Plot[Sin[x], {x, 0, π}]

The result of formatting is:


Text

The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog.

The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog. The quick red fox jumped over the lazy dog.

Inline code

Plot[Sin[x], {x, 0, π}]

Plot[Sin[x], {x, 0, π}]

Block code

Plot[Sin[x], {x, 0, π}]
Plot[Sin[x], {x, 0, π}]
Plot[Sin[x],{x, 0, π}]
Plot[Sin[x], {x, 0, π}]

I would say that the background gray used for the quotation environment is exactly the same gray as used for both the inline and block code environments. Further, the utility I use to read the RGB values of pixels on my screen agrees with my assessment.

  • It's not the same grey. Its as far as I can see #eee for code and #f0f0f0 for quote. You can use e.g. Chrome dev tools to see those CSS entries. – halirutan Mar 20 '15 at 5:42
  • @halirutan. I am using Safari. I get exactly the same values for the background gray for quoted text, code, and quoted code. I am reading my screen with the xScope utility. – m_goldberg Mar 20 '15 at 7:04
  • Nevertheless. You can go to Safari -> Preferences -> Advanced and check the box "Show Develop Menu". After that you can make a Ctrl+Click on the quote or code box and do Inspect Element. In the opening window you will find (and you are able to change!) the style for element. Here, in my Safari, I get different colorvalues. The same that I posted above. – halirutan Mar 20 '15 at 7:51

You must log in to answer this question.

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