-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add nix syntax support #523
Comments
see also: |
Nix is one of the extra syntax definitions that gets bundled in with [package]
name = "demo"
version = "0.1.0"
edition = "2021"
[dependencies]
syntect = "5.2.0"
two-face = "0.3.0" const NIX_TEXT: &str = r#"{ lib }:
let
defaultSourceType = tname: {
shortName = tname;
isSource = false;
};
in lib.mapAttrs (tname: tset: defaultSourceType tname // tset) {
fromSource = {
isSource = true;
};
binaryNativeCode = {};
binaryBytecode = {};
binaryFirmware = {};
}"#;
fn main() {
let syn_set = two_face::syntax::extra_newlines();
let theme_set = two_face::theme::extra();
let syn_ref = syn_set.find_syntax_by_extension("nix").unwrap();
let theme = theme_set.get(two_face::theme::EmbeddedThemeName::Nord);
let htmlified =
syntect::html::highlighted_html_for_string(NIX_TEXT, &syn_set, syn_ref, theme).unwrap();
println!("{htmlified}");
} prints out HTML that renders as vv in my browser |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you add the nix language as supported language?
It has a syntax definition file here: https://github.com/bbenoist/vscode-nix/blob/master/syntaxes/nix.tmLanguage
The text was updated successfully, but these errors were encountered: