Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting request: Nix #5359

Open
1 task done
joepie91 opened this issue Dec 12, 2024 · 3 comments
Open
1 task done

Syntax highlighting request: Nix #5359

joepie91 opened this issue Dec 12, 2024 · 3 comments

Comments

@joepie91
Copy link

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

@ssddanbrown
Copy link
Member

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.

@joepie91
Copy link
Author

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?

@ssddanbrown
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants