-
Notifications
You must be signed in to change notification settings - Fork 207
Introduction tooltip corresponds to the first paragraph #1344
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love adding another configuration but if it is not achievable via CSS this seems reasonable.
I'll let @larsoner merge.
I think this is probably what we want, and looks like FireFox added support in 2019 so probably okay to use nowadays: https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-line-clamp#truncating_a_paragraph It's a bigger PR but in principle then people can just override the number of lines, box width, etc. to their liking rather than us having some artificial character limit. @lucyleeow do you agree it's a better way forward? If so then @fgmacedo would you be up for trying this? |
I'm already aware of this. But I cannot get to make it work for any situation.
The final CSS was:
My result was (note the ellipsis on the second line): It added the ellipsis, but no text was truncated. So you need to get in sync how many lines of text can be displayed with the font, margin, size, etc... to get the exactly configuration on the clamp, because it doesn't get rid of the next line... if the container is larger / smaller, things are going to break. This is why I called the solution "fragile". |
100% prefer CSS option. We don't want another config. |
…no longer truncated
Changing the approach:
Do you agree with this? |
Yes that sounds good! Looks like there is a tiny visual regression in this PR where the mouseover "black box" doesn't cover the whole tile, for example mousing over I see Whereas on latest dev I see: Not sure if it's fixable or not...? One solution would be to make one div with |
That's exactly what I was trying to suggest above when I said
But @larsoner has said it much more clearly :) |
Tests passing locally. Is |
real but unrelated to this PR. Its present in #1346 as well. |
I've currently set the default to 4 lines, but I might have been a bit conservative. How about increasing it to 6 lines? Preview: Also, I've missed the |
Failure in sphinx dev was due to sphinx-doc/sphinx#12425 and I pushed a commit to #1346. Once that lands I'll merge |
Rendered doc looks good and locally I tested it on MNE-Python and things looked good so in it goes, thanks @fgmacedo ! |
… to version 0.17.0 v0.17.0 ------- Support for Python 3.8 and Sphinx 4 dropped in this release. Requirement is now Python >= 3.9 and Sphinx >= 5. **Implemented enhancements:** - Introduction tooltip corresponds to the first paragraph `#1344 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1344>`__ (`fgmacedo <https://github.com/fgmacedo>`__) - FIX Jupyterlite in CircleCI artifact `#1336 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1336>`__ (`lesteve <https://github.com/lesteve>`__) - MNT: Rename README.rst to GALLERY_HEADER.rst `#1321 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1321>`__ (`timhoffm <https://github.com/timhoffm>`__) - [ENH] Add custom thumbnails for failing examples `#1313 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1313>`__ (`tsbinns <https://github.com/tsbinns>`__) - ENH integrate download/launcher links into ``pydata-sphinx-theme`` secondary sidebar `#1312 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1312>`__ (`Charlie-XIAO <https://github.com/Charlie-XIAO>`__) - add option for zip downloads `#1299 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1299>`__ (`jamiecook <https://github.com/jamiecook>`__) - Allow setting animation format from gallery config `#1243 <https://github.com/sphinx-gallery/sphinx-gallery/pull/1243>`__ (`QuLogic <https://github.com/QuLogic>`__) (NEWS truncated at 15 lines)
Closes: #1066 (related to #1085).
With my custom-sized gallery
Without adjusting the
padding
, I got this:Note that given the padding was
10px 10px 10px 10px
, the bottom exposes the top content of the next truncated line:Adjusting the
padding
, I got this:With full default CSS
I've adjusted the clamp to 6 lines, so longer texts use full space, and smaller ones are automatically reduced (states forced to :hover):