Code blocks are automatically trimmed #4958

Closed
opened 2026-02-05 09:29:26 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @Sympatron on GitHub (Sep 23, 2024).

Describe the Bug

All code blocks are automatically trimmed at the end in the viewer. In the editor trailing empty lines are shown, but when viewing a page empty lines at the end are stripped.
This is quite annoying, because that means that script I want to copy paste from the block to a shell will not automatically execute the last command, because of the missing new line at the end.
Even if the last line contains whitespace it is still stripped.

Steps to Reproduce

  1. Edit a page
  2. Add a code block
  3. Enter code + empty lines
  4. Save
  5. Empty lines are gone

Expected Behaviour

All lines entered in the editor should be shown in the viewer.
At the very least non-empty lines (containing only whitespace) should be kept.

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v24.05.1

Originally created by @Sympatron on GitHub (Sep 23, 2024). ### Describe the Bug All code blocks are automatically trimmed at the end in the viewer. In the editor trailing empty lines are shown, but when viewing a page empty lines at the end are stripped. This is quite annoying, because that means that script I want to copy paste from the block to a shell will not automatically execute the last command, because of the missing new line at the end. Even if the last line contains whitespace it is still stripped. ### Steps to Reproduce 1. Edit a page 2. Add a code block 3. Enter code + empty lines 4. Save 5. Empty lines are gone ### Expected Behaviour All lines entered in the editor should be shown in the viewer. At the very least non-empty lines (containing only whitespace) should be kept. ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v24.05.1
OVERLORD added the 🐛 Bug:cat2:🐈 Possible duplicate labels 2026-02-05 09:29:26 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Sep 24, 2024):

Thanks for reporting @Sympatron,
I'm going to close this off though as I feel #2638 already covers this scenario/request.

@ssddanbrown commented on GitHub (Sep 24, 2024): Thanks for reporting @Sympatron, I'm going to close this off though as I feel #2638 already covers this scenario/request.
Author
Owner

@Sympatron commented on GitHub (Sep 24, 2024):

You are right, this is the same issue. I did not find it. But it is open for 3,5 years with no comment so far...

@Sympatron commented on GitHub (Sep 24, 2024): You are right, this is the same issue. I did not find it. But it is open for 3,5 years with no comment so far...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4958