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

show some content of readme if is too long #8570

Merged
merged 2 commits into from
May 13, 2021
Merged

Conversation

lyndaidaii
Copy link
Contributor

@lyndaidaii lyndaidaii commented May 5, 2021

Summary of the changes (in less than 80 characters):

we are using clamp.js to cut off the html element. Here we are going to increase the number of lines to cut off.

clamp(): this controls where and when to clamp the text of an element.

useNativeClamp (Boolean). Enables or disables using the native -webkit-line-clamp in a supported browser (ie. Webkit). It defaults to true if you're using Webkit, but it can behave wonky sometimes so you can set it to false to use the JavaScript- based solution.

            var height = getMaxHeight(clampValue);
            if (height <= element.clientHeight) {
                clampedText = truncate(getLastChild(element), height);
            }

before:
nugetcleaner.PNG

after :
readme0

Addresses #8564

@lyndaidaii lyndaidaii requested a review from a team as a code owner May 5, 2021 18:45
@joelverhagen
Copy link
Member

In your screenshot it seems that the current behavior looks more like 0 or 1 lines. Does line count 10 not have the effect that we are expecting?

@lyndaidaii
Copy link
Contributor Author

lyndaidaii commented May 5, 2021

In your screenshot it seems that the current behavior looks more like 0 or 1 lines. Does line count 10 not have the effect that we are expecting?

increase the number from 10 to 30, it will increase the chunk height(number line we define * line height)
if chunk height is less then one html element height, it will show ... . when value is 10, the cut off height is less than html element height, so that it show '...' instead, in this readme, the image height larger than height of 10 lines.

If I remove the image and badge on readme above. then it will show the number of lines:
readmeexample

@loic-sharma
Copy link
Contributor

loic-sharma commented May 7, 2021

@joelverhagen FYI our plan is to display the entire readme once we move to a tabbed design. In other words, we don't need to get the clamping behavior 100% right given this problem will disappear soon enough :)

@lyndaidaii lyndaidaii merged commit 4ec4719 into dev May 13, 2021
@lyndaidaii lyndaidaii mentioned this pull request May 18, 2021
5 tasks
@joelverhagen joelverhagen deleted the showmorewithreadme branch August 22, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants