mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-05 16:49:47 +03:00
No Branch/Tag Specified
development
l10n_development
further_theme_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#1244
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking 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 @FMCUSystemAdmins on GitHub (Jul 2, 2019).
Apologies if this has been submitted already, but I didn't see anything out there. We use quite a bit of tables in our documentation and have a need for them to be alphabetically sorted based on a particular column (in our case, the first column). We would like to request an auto-sort feature for tables that would sort them alphabetically based on a chosen column.
This would ease the management of tables that have quite a bit of rows as well as any future additions to the table.
@ssddanbrown commented on GitHub (Jul 3, 2019):
Thanks for the suggestion @FMCUSystemAdmins, I can see how this would be useful. Just to confirm, Do you desire this feature primarily as an editor of a table or as a viewer of a table?
@FMCUSystemAdmins commented on GitHub (Jul 4, 2019):
We’re finding a need for it from the editor standpoint.
@essdeeay commented on GitHub (Feb 6, 2020):
I've added +1 for this as a feature.
@Mr-Sloth commented on GitHub (Feb 12, 2021):
Eventually a different table plugin would make sense. Something like a filter, sort, searchable table would be overpowered. But sorting in edit mode is also a great addition.
@C493 commented on GitHub (Aug 23, 2021):
I'd like to +1 this request.
I would also like viewers of the page to be able to sort tables by any column by clicking on the column heading.
@gschirinzi commented on GitHub (Sep 21, 2021):
+1 for this request
Mainly for viewers to sort tables on any desired column
@Montg0mery commented on GitHub (Mar 25, 2022):
Even just having client-side table sorting when viewing a page would be very useful, as a starting point.
@crpb commented on GitHub (Mar 25, 2022):
For those who want sorting at least in the view.
As you can just copy the sorted Table and overwrite the current Content you can at least do some basic Formating with it without relying on something like 'LibreOffice-Calc'.
Custom HTML Head Entry
I use this nginx-snippet, so i don't have to rely on external Sources.
The

autoindexcan be left out naturally.@robert-andreas commented on GitHub (Apr 11, 2022):
Could you share the content of that file :-)?
@crpb commented on GitHub (Apr 11, 2022):
Could be that someone did a few modifications in the office. I'm not all versed in Javascript :-).
https://gist.github.com/crpb/705dbebe326573e6a36c12c415207d59
@ssddanbrown commented on GitHub (Dec 13, 2022):
Here's my no-library take for in-WYSIWYG-editor table sorting. Allows sorting via double clicking column headers.
Supports inverse sort on re-sort of same column. Lightly tested on v22.11, Might have side-affects.
Just needs to be added to the "Custom HTML Head Content" customization setting:
@Coros commented on GitHub (Jul 18, 2023):
Does anyone have the solution from @crpb working? I've obtained the jquery and datatable files from datatables.net. I've got an alias in Apache for a /localjs path. I've added the header script provided to BookStack. The browser console reports:
uncaught sortable: el must be an htmlelementI assume based on the header script I needed to add a table ID of bkmrk-sorted-table but that didn't help either.
@crpb commented on GitHub (Jul 19, 2023):
@Coros that datatables-hack broke here with the release in may and nobody "cried" enough to make it working again since then :P.
I think it was v23.05 - maybe this helps to determine where it got mangled.
I currently implemented https://github.com/BookStackApp/BookStack/issues/1518#issuecomment-1349568398 which worked since then without any issues but of course it is "something different".
@Coros commented on GitHub (Jul 20, 2023):
@crpb Thanks for the update. I would really like the tables to be sorted by the user/viewer. We're migrating away from Confluence and have some rather large tables that help to have on demand sorting. I implemented the WYSIWIG editor change but it didn't seem to sort properly. It only reversed the order rather than sorting by alpha/num. I'll give it another try.
edit: I had a couple blank rows in the table and I think that caused problems. After removing those, it does sort properly in the editor.
@TineUser commented on GitHub (Jul 25, 2023):
@ssddanbrown: Not bad, but this allows sorting only for editors. It would be great if viewers can sort the tables, too.
@mlbarrow commented on GitHub (Sep 3, 2023):
@ssddanbrown I'm so amped by your table sort hack above that I had to make this post. Thanks for this. I'll also take this opportunity to 👍 a feature to do this out of the box. I'd prioritize the feature for those with editor permissions (I'm biased), but also see the value for viewers.
A big 💯 for your work on Bookstack, too!!!
@rnldnkp commented on GitHub (Oct 13, 2024):
@ssddanbrown Very nice! Still works as of today. Should be available by default.
Any change you know how to fix this for the 'viewer' mode, which allows live (stateless) sorting? Currently only works in Editing mode.
@alexschomb commented on GitHub (Oct 17, 2024):
I had the same request by a customer for manual sorting of tables in the frontend. Thanks to the help of modern AI technology and my humble webdev experience, I was able to develop a working solution that even implements up/down arrows next to the column headers. It will work in both light & dark mode and will make use of the CSS variables that can be defined in the customization settings. You are welcome to use it or even implement it into BookStack.
Just add the following to the "Custom HTML Head Content" in the customization settings:
@rnldnkp commented on GitHub (Oct 17, 2024):
Oh wow, @alexschomb that worked instantly!
Many many thanks! Such a feature (both front and backend) should be available by default. Maybe @ssddanbrown could adopt both?
@alexschomb commented on GitHub (Oct 17, 2024):
@rnldnkp Using both scripts together won't work because they will interfere due to similar function names. I took the liberty to advance my script so that it should be working now in the backend editor as well. There is one little bug that I couldn't solve that causes the sorting state of a column header to be saved as well. Actually, this might even be called a feature, but I think it might be bad practice and should be solved. I did some tests with the TinyMCE event
editor.on('SaveContent', function(e) {...}), but somehow the state of the sorting icon was still saved to the database. Maybe there is a different event to listen to. Perhaps @ssddanbrown has a better idea.By the way, the script also has a new feature to reset sorting when clicking on the same column header for the third time.
@rnldnkp commented on GitHub (Oct 17, 2024):
Nice :)
Somehow I can use both by the way. Currently the backend is de first script (click header), frontend is the second (with arrows).
One uniform solution for both is better of course!
@TineUser commented on GitHub (Oct 18, 2024):
The new head content sounds great but doesn't work for me. Does this only work with newer BookStack releases? I'm using BookStack v24.02.3 because I can't upgrade PHP at the moment.
So I reverted back to this head content https://github.com/BookStackApp/BookStack/issues/1518#issuecomment-1349568398 which is working fine but only in the backend editor.
@alexschomb commented on GitHub (Oct 18, 2024):
Sorry, I only tested it with the latest Docker version of BookStack. Can't test older versions right now, but possibly the CSS selector is the reason. @ssddanbrown used
table tr:first-child td, table tr:first-child thwhich is less specific thanthead tr td(tableis implied by earlier lines) of my code. My code will only work with table headers that were defined as such in the TinyMCE Editor. It's likely that older versions of BookStack didn't support table headers and a more general approach (the first row of all tables) is required. Feel free to replace my selector withtr:first-child td, tr:first-child th, it might be working.@TineUser commented on GitHub (Oct 19, 2024):
Sorry, I don't understand what to replace exactly. I'm not a developer so I don't have experience in such coding.
@alexschomb commented on GitHub (Oct 19, 2024):
@TineUser in my code above replace this line of code from
to this
@TineUser commented on GitHub (Oct 19, 2024):
@alexschomb: Thank you. This works now in editor and viewer mode but it also sorts the column headers.
@TineUser commented on GitHub (Oct 19, 2024):
@alexschomb: OK, now I understand how your script is working. You have to define a header row in the table for the sorting feature. Then it works as you scripted it.
But there's one strange thing: When configuring the first row as header there will be inserted one more column which is empty but has the sorting icon.
This is in editor and viewer mode.
@alexschomb commented on GitHub (Oct 20, 2024):
@TineUser thanks for the feedback. Unfortunately, I can't test with other versions at the moment. I can't reproduce the issue with the newest version.
@GamerClassN7 commented on GitHub (Jul 1, 2025):
Hi @alexschomb,
any idea how to fix miss aligment of arrows ?
for anyone to make it work with new version change line 45 to
const headers = table.querySelectorAll("thead tr:first-child td, thead tr:first-child th");@GamerClassN7 commented on GitHub (Jul 9, 2025):
Hello,
@ssddanbrown could this hack be incorporated and refined as an official bookstack hack since when using a lot of tables this feature is awesome 👍 I try to refine it myself, but for some reasons I was not able to use the new version of BS, mostly the styles.
Thank you in advance for your opinion!!!
Also thanks again for this super useful self hosted gem 💎
@ssddanbrown commented on GitHub (Jul 9, 2025):
@GamerClassN7 Maybe in the future but I'm putting a pause on new editor-based hacks until we're further along the process of switching across to the new editor.