Restrict Export Options #3833

Closed
opened 2026-02-05 07:37:13 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @oleteacher on GitHub (Jun 1, 2023).

Describe the feature you'd like

Firstly, what a wonderful project!

Currently users (visitors) can export in all formats. It would be nice if admin could restrict what formats are allowed. At the moment only see ability to turn export on / off.

Describe the benefits this would bring to existing BookStack users

In our case we would use in a classroom enviroment. Having the ability to only allow certain formats like PDF would help creating study guides.

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

I am not sure about this question, not a programmer or at least not a very good one:)

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?

Not using yet, just scoping

Additional context

No response

Originally created by @oleteacher on GitHub (Jun 1, 2023). ### Describe the feature you'd like Firstly, what a wonderful project! Currently users (visitors) can export in all formats. It would be nice if admin could restrict what formats are allowed. At the moment only see ability to turn export on / off. ### Describe the benefits this would bring to existing BookStack users In our case we would use in a classroom enviroment. Having the ability to only allow certain formats like PDF would help creating study guides. ### Can the goal of this request already be achieved via other means? I am not sure about this question, not a programmer or at least not a very good one:) ### 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? Not using yet, just scoping ### Additional context _No response_
OVERLORD added the 🔨 Feature Request label 2026-02-05 07:37:13 +03:00
Author
Owner

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

Thanks for the kind words, and your thoughts in this request @oleteacher, but to be honest making each option individually controllable is a level of option/configuration I try to avoid in BookStack.

If you just wanted to hide the other options in the export menu, I could share some "Custom HTML Head Content" that you could add in the BookStack settings if desired to hide those, although they could still be accessed if people know the export URL. You could alternatively/additionally look for and block the URLs that look like export URLs, at a webserver level, but this will be a little more complicated to set-up.

@ssddanbrown commented on GitHub (Jun 2, 2023): Thanks for the kind words, and your thoughts in this request @oleteacher, but to be honest making each option individually controllable is a level of option/configuration I try to avoid in BookStack. If you just wanted to hide the other options in the export menu, I could share some "Custom HTML Head Content" that you could add in the BookStack settings if desired to hide those, although they could still be accessed if people know the export URL. You could alternatively/additionally look for and block the URLs that look like export URLs, at a webserver level, but this will be a little more complicated to set-up.
Author
Owner

@oleteacher commented on GitHub (Jun 2, 2023):

Thanks for reply @ssddanbrown.

"If you just wanted to hide the other options in the export menu, I could share some "Custom HTML Head Content" that you could add in the BookStack settings if desired to hide those, although they could still be accessed if people know the export URL. You could alternatively/additionally look for and block the URLs that look like export URLs, at a webserver level, but this will be a little more complicated to set-up."

I understand how to hide using css and also how to edit and strip out the other export code. But then on updates, would have to do it all over and that is not ideal on a school network. Hard enough to get IT department to approve a script like this. Editing every time most likely setoff the "alarm".

Please keep the option in mind, surely others would find the option useful:)

@oleteacher commented on GitHub (Jun 2, 2023): Thanks for reply @ssddanbrown. "If you just wanted to hide the other options in the export menu, I could share some "Custom HTML Head Content" that you could add in the BookStack settings if desired to hide those, although they could still be accessed if people know the export URL. You could alternatively/additionally look for and block the URLs that look like export URLs, at a webserver level, but this will be a little more complicated to set-up." I understand how to hide using css and also how to edit and strip out the other export code. But then on updates, would have to do it all over and that is not ideal on a school network. Hard enough to get IT department to approve a script like this. Editing every time most likely setoff the "alarm". Please keep the option in mind, surely others would find the option useful:)
Author
Owner

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

But then on updates, would have to do it all over

You shouldn't need to do this on all updates, maybe in a rare case the CSS target changes but that shouldn't be often if the CSS is written smartly. You can add CSS via the "Custom HTML Head Content" customization setting within the BookStack settings when logged in as an admin.

Even if you wanted to do this via stripping out the other export code (Presumable at a HTML level), this could be done by overriding the export options list using our visual theme system.

@ssddanbrown commented on GitHub (Jun 2, 2023): > But then on updates, would have to do it all over You shouldn't need to do this on all updates, maybe in a rare case the CSS target changes but that shouldn't be often if the CSS is written smartly. You can add CSS via the "Custom HTML Head Content" customization setting within the BookStack settings when logged in as an admin. Even if you wanted to do this via stripping out the other export code (Presumable at a HTML level), this could be done by overriding the [export options list](https://github.com/BookStackApp/BookStack/blob/development/resources/views/entities/export-menu.blade.php) using our [visual theme system](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/visual-theme-system.md).
Author
Owner

@oleteacher commented on GitHub (Jun 2, 2023):

Thank you for tips! If you have any code examples, be happy to see them.

@oleteacher commented on GitHub (Jun 2, 2023): Thank you for tips! If you have any code examples, be happy to see them.
Author
Owner

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

Here's a simple approach:

<style>
#export-menu a[href$="/export/html"],
#export-menu a[href$="/export/plaintext"],
#export-menu a[href$="/export/markdown"] {
    display: none;
}
</style>
@ssddanbrown commented on GitHub (Jun 2, 2023): Here's a simple approach: ```html <style> #export-menu a[href$="/export/html"], #export-menu a[href$="/export/plaintext"], #export-menu a[href$="/export/markdown"] { display: none; } </style> ```
Author
Owner

@oleteacher commented on GitHub (Jun 3, 2023):

<style>
#export-menu a[href$="/export/html"],
#export-menu a[href$="/export/plaintext"],
#export-menu a[href$="/export/markdown"] {
    display: none;
}
</style>

Thanks Dan. This would work in a pinch.

@oleteacher commented on GitHub (Jun 3, 2023): > ``` > <style> > #export-menu a[href$="/export/html"], > #export-menu a[href$="/export/plaintext"], > #export-menu a[href$="/export/markdown"] { > display: none; > } > </style> > ``` Thanks Dan. This would work in a pinch.
Author
Owner

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

Happy to help.
I'm going to go ahead and close this off since I don't intend to add granular export option control as per my original comment above.

@ssddanbrown commented on GitHub (Jun 7, 2023): Happy to help. I'm going to go ahead and close this off since I don't intend to add granular export option control as per [my original comment above](https://github.com/BookStackApp/BookStack/issues/4280#issuecomment-1574115432).
Author
Owner

@oleteacher commented on GitHub (Jun 8, 2023):

Thank you for your help. Hope you keep this in mind in future updates.

@oleteacher commented on GitHub (Jun 8, 2023): Thank you for your help. Hope you keep this in mind in future updates.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3833