Skip to content
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

Brief and extensive docs with ? and ?? #25930

Closed
timholy opened this issue Feb 7, 2018 · 6 comments
Closed

Brief and extensive docs with ? and ?? #25930

timholy opened this issue Feb 7, 2018 · 6 comments
Labels
docsystem The documentation building system

Comments

@timholy
Copy link
Sponsor Member

timholy commented Feb 7, 2018

Most methods have short documentation, but there are a few exceptions. It might be nice to have ??foo mean something like "print only the first few lines of help for foo," basically for experienced users to remind themselves what arguments should be supplied in what order. EDIT: or the opposite, long docs with ?? and short docs with ?.

Inspired by some extremely thorough (and useful) documentation in JuliaImages/ImageFiltering.jl#54.

@timholy timholy added the docsystem The documentation building system label Feb 7, 2018
@cormullion
Copy link
Contributor

cormullion commented Feb 7, 2018

Users might expect ? to give brief, and ?? more copious, information. (Is this similar to vvv options for Unix commands?)

@yurivish
Copy link
Contributor

yurivish commented Feb 7, 2018

Brief docs with ? would be wonderful — I’ve often had to scroll through pages of output at the REPL when I just needed a quick overview.

Additionally, if the brief display became standard it would be a forcing function for the convention of supplying a quick summary sentence at the start of a docstring, which would lend itself well to tooling (e.g. hover a function name in your editor to see a tooltip with the signature and brief description).

@ChristianKurz
Copy link
Contributor

If this is implemented, it would be nice to have separate REPL-modes for brief and full help.

E.g. typing ? would change the prompt to brief help> and adding another ? would change to help>.
Additionally, just entering ? and hitting enter without further text should hint at adding another ? to show full help.

@StefanKarpinski
Copy link
Sponsor Member

I do think that ? for brief default help and ?? for long help would be good (opened in a pager).

@StefanKarpinski StefanKarpinski added this to the 1.x milestone May 16, 2018
@tpapp
Copy link
Contributor

tpapp commented Nov 17, 2018

opened in a pager

It would be best if that was customizable, eg for opening nicely formatted HTML in a browser.

@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Jan 19, 2019

If this is implemented, it would be nice to have separate REPL-modes for brief and full help.

Is it really needed? Some users know some functions to have long text, but for new users all functions potentially have long docs. Wouldn't something simple like this be ok:

help?> potentially_long_function  # simulated here with: unsafe_pointer_to_objref
search: unsafe_pointer_to_objref

  unsafe_pointer_to_objref(p::Ptr)

  Convert a Ptr to an object reference. Assumes the pointer refers to a valid heap-allocated Julia object. If this is not the case, undefined
  behavior results, hence this function is considered "unsafe" and should be used with care.
PRESS ENTER FOR MORE LINES, or q for no more.

That last line wouldn't actually display for this function, as there's nothing more to display or any function with shorter text than this or 6-8 lines. But for longer ones, if would be there in bold or other color, and be overwritten with the next few lines (or all?) when not-q pressed.

Sometimes I would like docs to display as with, i.e. take the full screen and then disappear and safe screen space (this could be an ENV option, to pipe to e.g. less and potentially a threshold length that would trigger this):

shell> less LICENSE.md

julia>

@timholy timholy changed the title Brief docs with ?? Brief and extensive docs with ? and ?? Dec 31, 2019
timholy added a commit that referenced this issue Dec 31, 2019
A level-1 header "Extended help" indicates that the content that follows
requires `??foo` rather than just `?foo`.
timholy added a commit that referenced this issue Dec 31, 2019
A level-1 header "Extended help" indicates that the content that follows
requires `??foo` rather than just `?foo`.
timholy added a commit that referenced this issue Jan 19, 2020
A level-1 header "Extended help" indicates that the content that follows
requires `??foo` rather than just `?foo`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system
Projects
None yet
Development

No branches or pull requests

7 participants