Syntax highlighting request: Nix #5077

Open
opened 2026-02-05 09:38:30 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @joepie91 on GitHub (Dec 12, 2024).

Describe the feature you'd like

Adding Nix to the supported languages for syntax highlighting, for example using this (CodeMirror 6) mode: https://github.com/replit/codemirror-lang-nix

Describe the benefits this would bring to existing BookStack users

Ability to syntax-highlight Nix code :) That's all there is to it, really. Nix and NixOS are rapidly growing in adoption, and Bookstack is already packaged in NixOS, so this seems like it'd benefit some subset of other users too.

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

Yes; by patching the code and rebuilding the frontend JS assets. This doesn't seem like a sustainable solution however, as future additions of other languages are likely to break the patch, and so it makes upgrades significantly harder.

(A first-class "add your own syntax highlighters" mechanism would also be a viable solution, but I imagine that that'd be more development work, not less, at the current rate of syntax highlighting requests.)

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundamental request

How long have you been using BookStack?

Under 3 months

Additional context

This was prompted by me working on a wiki for learning NixOS, for which proper syntax highlighting is quite important: https://wiki.slightly.tech/books/learning-nixos

Originally created by @joepie91 on GitHub (Dec 12, 2024). ### Describe the feature you'd like Adding Nix to the supported languages for syntax highlighting, for example using this (CodeMirror 6) mode: https://github.com/replit/codemirror-lang-nix ### Describe the benefits this would bring to existing BookStack users Ability to syntax-highlight Nix code :) That's all there is to it, really. Nix and NixOS are rapidly growing in adoption, and Bookstack is already packaged in NixOS, so this seems like it'd benefit some subset of other users too. ### Can the goal of this request already be achieved via other means? Yes; by patching the code and rebuilding the frontend JS assets. This doesn't seem like a sustainable solution however, as future additions of other languages are likely to break the patch, and so it makes upgrades significantly harder. (A first-class "add your own syntax highlighters" mechanism would also be a viable solution, but I imagine that that'd be *more* development work, not less, at the current rate of syntax highlighting requests.) ### Have you searched for an existing open/closed issue? - [X] I have searched for existing issues and none cover my fundamental request ### How long have you been using BookStack? Under 3 months ### Additional context This was prompted by me working on a wiki for learning NixOS, for which proper syntax highlighting is quite important: https://wiki.slightly.tech/books/learning-nixos
OVERLORD added the 🔨 Feature Request label 2026-02-05 09:38:30 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Dec 12, 2024):

Thanks for the request @joepie91,
I usually limit the scope of languages to add to that officially supported by CodeMirror, for which this is not, otherwise it comes down to demand, so probably not one I'd look to add support for right away.

@ssddanbrown commented on GitHub (Dec 12, 2024): Thanks for the request @joepie91, I usually limit the scope of languages to add to that officially supported by CodeMirror, for which this is not, otherwise it comes down to demand, so probably not one I'd look to add support for right away.
Author
Owner

@joepie91 commented on GitHub (Dec 12, 2024):

Hmm. Then what would be the recommended method for me to add Nix syntax highlighting to my own setup, given the fragility of the patching approach?

@joepie91 commented on GitHub (Dec 12, 2024): Hmm. Then what would be the recommended method for me to add Nix syntax highlighting to my own setup, given the fragility of the patching approach?
Author
Owner

@ssddanbrown commented on GitHub (Dec 12, 2024):

There's no official method right now.
There's an existing request in #2057 for custom mode support.

@ssddanbrown commented on GitHub (Dec 12, 2024): There's no official method right now. There's an existing request in #2057 for custom mode support.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5077