Blank lines inserted in to collapsible section upon saving #4277

Closed
opened 2026-02-05 08:24:36 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @OneFreemanWill on GitHub (Oct 24, 2023).

Describe the Bug

When pasting specific HTML content into a collapsible section in Bookstack, extra blank lines are inserted within the <details> element upon saving the page multiple times. Noticed this bug when copy and pasting from Microsoft's practice assessment portal, but might be reproducible from other sites too.

Steps to Reproduce

Copy HTML content from Microsoft's practice assessment website (linked below). Copy only the result that appears after selecting an answer in to the collapsible section in Bookstack.

https://learn.microsoft.com/en-us/credentials/certifications/exams/pl-100/practice/assessment?assessment-type=practice&assessmentId=63&source=docs

Alternatively, here is a minimal example to reproduce the issue. Just use the source code editor to paste it within the collapsible section.

<details>
  <section id="test-section" class="has-background-success-light padding-lg padding-top-xxs padding-bottom-xxs margin-top-md">
  </section>
</details>

Once you have added the content to the collapsible section, save the page, edit, and save the page again.

Observe that extra blank lines <p>&nbsp;</p> are added within the <details> element each time the page is saved

Expected Behaviour

No extra blank lines should be added within the <details> element when saving the page.

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v23.08.3

Originally created by @OneFreemanWill on GitHub (Oct 24, 2023). ### Describe the Bug When pasting specific HTML content into a collapsible section in Bookstack, extra blank lines are inserted within the `<details>` element upon saving the page multiple times. Noticed this bug when copy and pasting from Microsoft's practice assessment portal, but might be reproducible from other sites too. ### Steps to Reproduce Copy HTML content from Microsoft's practice assessment website (linked below). Copy only the result that appears after selecting an answer in to the collapsible section in Bookstack. https://learn.microsoft.com/en-us/credentials/certifications/exams/pl-100/practice/assessment?assessment-type=practice&assessmentId=63&source=docs Alternatively, here is a minimal example to reproduce the issue. Just use the source code editor to paste it within the collapsible section. ``` <details> <section id="test-section" class="has-background-success-light padding-lg padding-top-xxs padding-bottom-xxs margin-top-md"> </section> </details> ``` Once you have added the content to the collapsible section, save the page, edit, and save the page again. Observe that extra blank lines `<p>&nbsp;</p>` are added within the `<details>` element each time the page is saved ### Expected Behaviour No extra blank lines should be added within the `<details>` element when saving the page. ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v23.08.3
OVERLORD added the 🐛 Bug📝 WYSIWYG Editor labels 2026-02-05 08:24:36 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 2, 2023):

Thanks for reporting @OneFreemanWill.
Yeah, unexpected content copied in externally could easily cause strange behaviour with details blocks.

I can look to improve filtering here, but it would be useful to have a proper example.
The simplified example provided is useful to reproduce, but It'd be good to have an example with some content within, to assess how we deal with formatting/handling the content itself.
I appreciate you linked to the Microsoft site, but that link requires sign-in and sign-up to Microsoft content which I'm not too keen on.

@ssddanbrown commented on GitHub (Nov 2, 2023): Thanks for reporting @OneFreemanWill. Yeah, unexpected content copied in externally could easily cause strange behaviour with details blocks. I can look to improve filtering here, but it would be useful to have a proper example. The simplified example provided is useful to reproduce, but It'd be good to have an example with some content within, to assess how we deal with formatting/handling the content itself. I appreciate you linked to the Microsoft site, but that link requires sign-in and sign-up to Microsoft content which I'm not too keen on.
Author
Owner

@ssddanbrown commented on GitHub (Dec 8, 2023):

Since there's been no follow up to my message above, I'll close this off, but if the issue remains as an annoyance please share a simplified example as per the above and I can re-open this to look into it further.

@ssddanbrown commented on GitHub (Dec 8, 2023): Since there's been no follow up to my message above, I'll close this off, but if the issue remains as an annoyance please share a simplified example as per the above and I can re-open this to look into it further.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4277