Include a vertical scroll bar inside a code block and allow users to specify how many lines show up in a code block. #3870

Open
opened 2026-02-05 07:44:09 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @mw-christensen on GitHub (Jun 20, 2023).

Describe the feature you'd like

It would be nice if you could specify how many rows or lines show up in a code block. As it is now, if I were to paste a code block with 1000 lines of code then I would have to do a lot of scrolling to get past the code block. If I could specify how many lines I wanted to show (like 25) then it would be very little scrolling to get past that point. There would be a vertical scroll bar so you could still see all the code. I feel like this would be useful for pages where you insert code as a reference.

To me the ideal would be this:
In the UI there is a text field for number of code lines shown. The default would be 25. The user could change it to anything. If the user changes it to 0 then it would be as many lines as there are lines of code (the current behavior). If the code block has more lines of code than what is specified, then a scroll bar shows up.

Describe the benefits this would bring to existing BookStack users

This would allow for cleaner pages where code snippets are posted and allow a user to easily scroll past code snippets that are not pertinent to them.

Here is an example where not having a vertical scroll bar can be quite annoying:

2023-06-20_12-22-39

Can the goal of this request already be achieved via other means?

Not that I can think of.

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundemental request

How long have you been using BookStack?

1 to 5 years

Additional context

Thanks! (I LOVE bookstack)

Originally created by @mw-christensen on GitHub (Jun 20, 2023). ### Describe the feature you'd like It would be nice if you could specify how many rows or lines show up in a code block. As it is now, if I were to paste a code block with 1000 lines of code then I would have to do a lot of scrolling to get past the code block. If I could specify how many lines I wanted to show (like 25) then it would be very little scrolling to get past that point. There would be a vertical scroll bar so you could still see all the code. I feel like this would be useful for pages where you insert code as a reference. To me the ideal would be this: In the UI there is a text field for number of code lines shown. The default would be 25. The user could change it to anything. If the user changes it to 0 then it would be as many lines as there are lines of code (the current behavior). If the code block has more lines of code than what is specified, then a scroll bar shows up. ### Describe the benefits this would bring to existing BookStack users This would allow for cleaner pages where code snippets are posted and allow a user to easily scroll past code snippets that are not pertinent to them. Here is an example where not having a vertical scroll bar can be quite annoying: ![2023-06-20_12-22-39](https://github.com/BookStackApp/BookStack/assets/103672717/4a44b41d-0fd8-4bad-9f70-832e7332c9bb) ### Can the goal of this request already be achieved via other means? Not that I can think of. ### Have you searched for an existing open/closed issue? - [X] I have searched for existing issues and none cover my fundemental request ### How long have you been using BookStack? 1 to 5 years ### Additional context Thanks! (I LOVE bookstack)
OVERLORD added the 🔨 Feature Request label 2026-02-05 07:44:09 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jun 20, 2023):

Thanks for the request.

Similar to #2679 and #4043.
Adding any code-block level option takes us into custom content syntax (including handling of,conversion and UI support) which I'm not too keen on.

Can the goal of this request already be achieved via other means?
Not that I can think of.

For particularly long code blocks, you could put them in a collapsible block to allow collapsing where not relevant.
Alternatively, you could add some custom CSS via settings to set a max height on all code blocks in page content. I could provide an example of this if you'd like.

@ssddanbrown commented on GitHub (Jun 20, 2023): Thanks for the request. Similar to #2679 and #4043. Adding any code-block level option takes us into custom content syntax (including handling of,conversion and UI support) which I'm not too keen on. > Can the goal of this request already be achieved via other means? > Not that I can think of. For particularly long code blocks, you could put them in a collapsible block to allow collapsing where not relevant. Alternatively, you could add some custom CSS via settings to set a max height on all code blocks in page content. I could provide an example of this if you'd like.
Author
Owner

@mw-christensen commented on GitHub (Jun 21, 2023):

Thanks for your response. I never thought of putting a code block inside a collapsible block but I just now tried it and it could work as a workaround. I will probably do that for now.

Thanks!

@mw-christensen commented on GitHub (Jun 21, 2023): Thanks for your response. I never thought of putting a code block inside a collapsible block but I just now tried it and it could work as a workaround. I will probably do that for now. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3870