1import type * as PrismNamespace from 'prismjs';23// A small Prism grammar for nushell, enough for the docs' pipelines:4// comments, strings, $variables, numbers with their units (1kb, 90sec),5// flags, keywords and operators. Tokens take the names Prism's themes6// already color.7export default function nushell(Prism: typeof PrismNamespace): void {8 Prism.languages.nu = {9 comment: {pattern: /(^|\s)#.*/, lookbehind: true, greedy: true},10 string: {pattern: /"(?:\\.|[^"\\\n])*"|'[^'\n]*'|`[^`\n]*`/, greedy: true},11 variable: /\$[A-Za-z_][\w-]*(?:\.[\w-]+)*/,12 keyword: /\b(?:let|mut|const|def|alias|if|else|for|in|while|loop|match|try|catch|return|break|continue|do|use|module|export)\b/,13 number: /\b\d+(?:\.\d+)?(?:kib|mib|gib|kb|mb|gb|tb|b|ns|us|ms|sec|min|hr|day|wk)?\b/i,14 boolean: /\b(?:true|false|null)\b/,15 // --flag or -f after a space, not a minus in an expression16 'attr-name': {pattern: /(\s)--?[A-Za-z][\w-]*/, lookbehind: true},17 operator: /\||==|!=|>=|<=|=~|!~|[<>=^]|\b(?:and|or|not|like)\b/,18 punctuation: /[{}[\]();,]/,19 };20 Prism.languages.nushell = Prism.languages.nu;21}