Always display first line of impl blocks even when collapsed by GuillaumeGomez · Pull Request #132155 · rust-lang/rust (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things I thought about: the problem with short sentences is that they don't overflow, and therefore don't generate the ellipsis. However if there is more content, users won't until expanded. So instead I tried to cheat a bit and added a ::after
element:
details.toggle:not([open]) > summary .docblock > :first-child { max-width: calc(100% - 1em); overflow: hidden; width: fit-content; white-space: nowrap; position: relative; text-overflow: clip; padding-right: 1em; } details.toggle:not([open]) > summary .docblock > :first-child::after { content: "…"; position: absolute; right: 0; top: 0; background-color: var(--main-background-color); }
However, it never gets displayed correctly on big text as it goes over it or is always stuck to the right side. I was hoping to kinda go around this issue by using padding
and was able to. It gives this result:
If you are ok with this result, I can go with it.