-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Stylistically disambiguate julia> in docstrings #55455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
If the styling is exactly the same, occasionally this can produce a bit of confusion or a double take when people mix it up with the REPL Julia prompt.
I agree it's confusing that the prompt in docstring examples is the same as the real prompt (only slightly indented). This change still seems very slight. How about just removing the colour completely? Green is a "live" prompt, plain white/black is documentation. |
OhMyREPL used red, people haven't complained about that. |
I somewhat don't like red because it makes me think |
But really black/white seems fine -- leave colour for the top-level things, and make the whole block of examples pretty plain. They are all short (or should be!) so the text is clear enough (or should be made so!). No need to highlight every single level of sub-headings. |
How short examples "should" be is IMHO very subjective and possibly depends on subject matter? Not everything can be demonstrated with a "short" example. To me the colored prompts in examples are actually very helpful, for docstrings with examples that have a slightly long-ish output -- it makes it visually very easy to go from one input line to the next, skipping the output. Granted, a similar effect would be attained for me if instead the output lines were shaded in gray or something like that. |
My big complaint is that the extensive highlighting (new on 1.12 beta) breaks the biggest distinction you want to make visually, in favour of making tiny distinctions. What I mean is this. When I ask for help inline at the REPL, my screen now has my input & output, and text & examples from help. Distinguishing those very clearly is the first concern. The second is clearly distinguishing text from example code, within the help. On 1.11 this is achieved by a small indent, and by making the whole example code block a different colour, which is great. Perhaps the 3rd concern is separating input from output within an example. On 1.12, there is still an indent, but the example code blocks are very hard to spot. They use the same bright highlighting for the example prompt as for the real live prompt. And they use no less than 5 different colours to tell me which parts of I realise some people really love everything highlighted in as many colours as possible everywhere. That's why we have OhMyREPL. Maybe Base/REPL should provide hooks to make it easy for that to hook onto the example printing. I also realise making this work was some work, and I don't want to disparage anyone. Maybe this work can still be made useful into OhMyREPL or something. But I'd vote to remove it from Base. This PR makes a super-tiny change, to add italics to There might be other ways to address this concern. For instance, maybe help printing should have a bracket around it, like what
This might be nice. This is what I called the 3rd distinction above. IMO experimenting with such things is the right level here. But really focused on what we want to achieve, and what we do not want to lose.
That's true. But compared to real code, when writing examples you have more freedom to pick a nice compact presentation, and good names. Which makes tools for seeing through the thicket less important. |
On that note, there's been some conversation on Slack about this and it's probably worth sharing this screenshot here: We can do this by querying the terminal background, which works pretty much everywhere (the Linux virtual console is the only exception I'm aware of, The difficulty lies in how we capture the response. |
One thing that would make it clearer is help mode being within a pager which triage was in support of #41423 |
If the styling is exactly the same, occasionally this can produce a bit of confusion or a double take when people mix it up with the REPL Julia prompt.
This has come up in OhMyREPL, and was brought up by @BioTurboNick after #54423 was merged.
There are a few ways we can try varying the style, here I've picked one of them so we've actually got a starting point for discussion: italic + different shade of green.