mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-07 11:19:38 +03:00
Include a vertical scroll bar inside a code block and allow users to specify how many lines show up in a code block. #3870
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
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?
How long have you been using BookStack?
1 to 5 years
Additional context
Thanks! (I LOVE bookstack)
@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.
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.
@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!