-
Notifications
You must be signed in to change notification settings - Fork 228
Implement scrollable code #1761
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
{{ $lines := .Get "lines" | default "25" }} | ||
{{ $lineHeight := add (float $lines) 1.5 }} | ||
|
||
<div class="expand-content overflow-auto my-4" style="height: {{ $lineHeight }}lh;"> |
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 suggest trying to use Tailwind CSS site-wide, so, in this case, you could try using the following Tailwind class instead of the style attribute as shown below. Can you give this a try and see if it works?
<div class="expand-content overflow-auto my-4" style="height: {{ $lineHeight }}lh;"> | |
<div class="expand-content overflow-auto my-4 h-[{{ $lineHeight }}lh]"> |
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 did try that before I opened this PR, and for some reason, it doesn't get picked up, but using the style: version does. I have no idea why.
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.
It may be that our version of Tailwind doesn't support those kinds of classes. Thank you for trying (and for reading my mind). 🙂
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.
Works well. Approved.
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.
LGTM!
Usage:
{{< scrollable-code lines="10" >}}
Content with many lines here...
{{< /scrollable-code >}}
Ideally used for just code blocks. In theory, you could use this for any content, but I think that would require a lot of re-tooling.