Possibility to add a gist from github or a gitlab snippet #3419

Closed
opened 2026-02-05 06:39:31 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @reeperbahnause on GitHub (Dec 29, 2022).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I would like to add a github gist or a gitlab snippet to a page.
I was not able to add a snippet like this:

<script src="https://gitlab.com/gitlab-org/gitlab/-/snippets/1234567890.js"></script>

Exact BookStack Version

21.11.1

Log Content

No response

PHP Version

7.4.26

Hosting Environment

docker compose

Originally created by @reeperbahnause on GitHub (Dec 29, 2022). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I would like to add a github gist or a gitlab snippet to a page. I was not able to add a snippet like this: ```html <script src="https://gitlab.com/gitlab-org/gitlab/-/snippets/1234567890.js"></script> ``` ### Exact BookStack Version 21.11.1 ### Log Content _No response_ ### PHP Version 7.4.26 ### Hosting Environment docker compose
OVERLORD added the 🐕 Support label 2026-02-05 06:39:31 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 29, 2022):

Yeah, the system will generally attempt to prevent usage of script tags within content.
You could use some specific syntax, along with some custom JavaScript in the head, to dynamically load custom scripts.
Unfortunately, The GitLab embed script is designed in a way that makes it very difficult to use in such a dynamic way though, so would be fair effort to produce a stable solution via this route.

Alternatively, probably a way about this via hacking around with the PAGE_INCLUDE_PARSE event in our logical theme system but again requires some hackery.

@ssddanbrown commented on GitHub (Dec 29, 2022): Yeah, the system will generally attempt to prevent usage of script tags within content. You could use some specific syntax, along with some custom JavaScript in the head, to dynamically load custom scripts. Unfortunately, The GitLab embed script is designed in a way that makes it very difficult to use in such a dynamic way though, so would be fair effort to produce a stable solution via this route. Alternatively, probably a way about this via hacking around with the [PAGE_INCLUDE_PARSE](https://github.com/BookStackApp/BookStack/blob/5393465ea7caf45997026323bb30f9bc2c6c1213/app/Theming/ThemeEvents.php#L86) event in our [logical theme system](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/logical-theme-system.md) but again requires some hackery.
Author
Owner

@reeperbahnause commented on GitHub (Dec 30, 2022):

Thank you for your quick response.
Could this issue be converted to a feature request? (if this makes any sense to you?)
Otherwise the issue can be closed, because I think implementing this in a hacky way doesn't make any sense.

@reeperbahnause commented on GitHub (Dec 30, 2022): Thank you for your quick response. Could this issue be converted to a feature request? (if this makes any sense to you?) Otherwise the issue can be closed, because I think implementing this in a hacky way doesn't make any sense.
Author
Owner

@ssddanbrown commented on GitHub (Dec 30, 2022):

Could this issue be converted to a feature request?

To be honest it's not something I'd look to specifically support. We already have code-block support built-in and I don't like to built to specific external platforms. For these kind of things I prefer to instead look at generic ways that can be used to integrate with such platforms, which in this case would be the logical theme system method.

Will therefore close this off.

@ssddanbrown commented on GitHub (Dec 30, 2022): > Could this issue be converted to a feature request? To be honest it's not something I'd look to specifically support. We already have code-block support built-in and I don't like to built to specific external platforms. For these kind of things I prefer to instead look at generic ways that can be used to integrate with such platforms, which in this case would be the logical theme system method. Will therefore close this off.
Author
Owner

@reeperbahnause commented on GitHub (Dec 30, 2022):

Sure thing. I understand your opinion on this.
Sorry for the noise ;-)

@reeperbahnause commented on GitHub (Dec 30, 2022): Sure thing. I understand your opinion on this. Sorry for the noise ;-)
Author
Owner

@ssddanbrown commented on GitHub (Dec 30, 2022):

No worries at all and thanks for the understanding.
If you do decide to do this via customization, don't hesitate to ask for general guidance/pointers.

@ssddanbrown commented on GitHub (Dec 30, 2022): No worries at all and thanks for the understanding. If you do decide to do this via customization, don't hesitate to ask for general guidance/pointers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3419