racket / scribble

Other
194 stars 90 forks source link

feat: add explicit buttons to heading titles #377

Closed sorawee closed 9 months ago

sorawee commented 9 months ago

This commit adds two buttons to each heading title. These buttons are by default hidden, but they will appear on hovering on the heading titles.

The first button is a "link here" button, which adjusts the URL of the current page to include an anchor to link to that heading title, similar to how GitHub makes each heading title in README documents a link to add an anchor.

The second button is to view Scribble source and internal link. Previously, clicking heading titles serves this functionality, but without an indicator that heading titles can be clicked, the feature is not discoverable. So this commit makes a transition toward an explicit button.

Example screenshots:

Page title

Screenshot 2023-10-14 at 1 38 13 PM

Section title

Screenshot 2023-10-14 at 1 38 04 PM
sorawee commented 9 months ago

Still not perfect, but this should be a bit better.

Screenshot 2023-10-13 at 9 13 31 PM

(It can be made better, but that will require a percentage value that is "ugly" instead. This is my best attempt without resorting to using the ugly numbers.)

mflatt commented 9 months ago

I'll second @jryans's suggestion and rationale to show the buttons only when mousing over the title.

sorawee commented 9 months ago

I made the update as requested.

Since we now show the buttons only on hovering over the heading titles, I removed the adjustments to make the buttons smaller*, to help with discoverability.

[*] well, there's still a place that needs this adjustment, since it would be too large with the full size.

mflatt commented 9 months ago

Thanks for the update! This looks good to me.