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

x/tools/cmd/godoc: add 'expand all' link to expand all examples #3081

Closed
vdobler opened this issue Feb 20, 2012 · 24 comments

Comments

Projects
None yet
10 participants
@vdobler
Copy link
Contributor

commented Feb 20, 2012

The code examples are initially closed in the html output of
godoc.  While this is perfectly fine for online browsing it
is unsuitable for a printout:  During printing the examples
should be open/folded out.
@dsymonds

This comment has been minimized.

Copy link
Member

commented Feb 20, 2012

Comment 1:

Printing such pages is not common, but this could be addressed by adding a little JS
toggle at the top to expand/collapse all the examples. I'd imagine some people printing
out reference material would *not* want the examples, so we should make sure that's easy
too.
It doesn't seem high priority, though.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2012

Comment 3:

Labels changed: added go1.1maybe.

@mewmew

This comment has been minimized.

Copy link
Contributor

commented Oct 9, 2012

Comment 4:

It would be possible to use CSS, if examples should be included by default when
printing. The js 'expand all' link would require user interaction before printing.
@media print
{
   .collapsed
   {
      display: none !important;
   }
   .expanded
   {
      display: block !important;
   }
}
@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2013

Comment 5:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@adg

This comment has been minimized.

Copy link
Contributor

commented Mar 18, 2013

Comment 6:

Labels changed: added godoc.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2013

Comment 7:

Labels changed: added go1.2maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2013

Comment 8:

Labels changed: added feature.

@robpike

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2013

Comment 9:

Not for 1.2.

Labels changed: removed go1.2maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 10:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 11:

Labels changed: removed feature.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 12:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 13:

Labels changed: added repo-tools.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title cmd/godoc: add 'expand all' link to expand all examples x/tools/cmd/godoc: add 'expand all' link to expand all examples Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

@agnivade

This comment has been minimized.

Copy link
Member

commented May 31, 2018

@andybons / @bradfitz for decision.

@rsc rsc added the NeedsFix label Jun 11, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2018

Per @andybons and @bradfitz, a trivial CL doing this is OK.

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 12, 2018

Perfect, thanks !

@agnivade agnivade self-assigned this Jun 12, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

@bradfitz / @andybons - I have been thinking about where to put this button on the page. I have decided to place it beside the "Example" header under which all examples are listed. It has one click access from the top level ToC and is in a position from where all examples are accessible.

expand1

It looks a bit clumsy to me. But I am not able to find a better place. Let me know if you think of a more suitable place.

/cc @ysmolsky , @jimmyfrasche for more inputs.

@jimmyfrasche

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

True. Maybe I misunderstood; the title does say to add an 'expand all' link. But I don't think we should expand all examples by default during printing, which the comment is doing. The user should be able to control this with a toggle.

@jimmyfrasche

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

Yea, the title and the description are not in sync. ping @vdobler for clarification.

When would you want to exclude some examples when printing?

I might not want to print all examples always. For eg- I might want only 1 or 2 examples. So I can expand them specifically and then print the document. I think that's a fair thing to ask.

@andybons

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

@agnivade I think your position in #3081 (comment) is fine. Let's move forward with that.

@gopherbot

This comment has been minimized.

Copy link

commented Jun 14, 2018

Change https://golang.org/cl/118935 mentions this issue: godoc: add link to expand/close all examples

@vdobler

This comment has been minimized.

Copy link
Contributor Author

commented Jun 15, 2018

@agnivade
My original intention was to have all examples printed by default or by clicking once
to open them all. I find it very annoying if I print out documentation just to find out
during reading that half of it is missing because it was an "interactive" document.
Like I do not order individual chapters from a book I like to have the whole together.
Skimming over an uninteresting example is not a big deal for me in a printout.

@agnivade

This comment has been minimized.

Copy link
Member

commented Jun 15, 2018

Thanks for clarifying.

or by clicking once to open them all.

Cool, we are going with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.