{"_id":"prismjs-terminal","_rev":"6-7aabd70a5db18576a368c08a5829b93e","name":"prismjs-terminal","dist-tags":{"latest":"1.2.4"},"versions":{"1.0.0":{"name":"prismjs-terminal","version":"1.0.0","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"prismjs-terminal@1.0.0","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/prismajs-term#readme","bugs":{"url":"https://github.com/isaacs/prismajs-term/issues"},"tap":{"ts":false,"color":true,"coverage":false,"node-arg":["--no-warnings","--loader","ts-node/esm"],"test-arg":["--color=full"],"test-env":["FORCE_COLOR=3"]},"dist":{"shasum":"9ce069bafe4d19af0c351d9dfa5cb3e1e01d9cbc","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.0.0.tgz","fileCount":35,"integrity":"sha512-VvDD4oijw+JHfnZXgXxYwh3PoPhry7avUVXdNIbryYaGLkTmVRtTp5Kle23N55Xjfjff6T4HfTB+lrPoMk2KLQ==","signatures":[{"sig":"MEUCIBVad1Ak1HuG4ZBCrevnX0gw1Run7nQYH7ah9okB9+zZAiEAnHxG04TH0jm7bpDs5s6K1VohRk40sE9HHPRD+vziCGk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":54396},"type":"module","module":"./dist/index.js","engines":{"node":">=14"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./themes":{"import":{"types":"./dist/themes/index.d.ts","default":"./dist/themes/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"e8b9501d138d128ef1cae190ce736a79c603bb1d","scripts":{"snap":"c8 tap","test":"c8 tap","format":"prettier --write . --loglevel warn","prepare":"tsc && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"endOfLine":"lf","printWidth":75,"arrowParens":"avoid","singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true},"repository":{"url":"git+https://github.com/isaacs/prismajs-term.git","type":"git"},"_npmVersion":"9.6.7","description":"PrismaJS syntax highlighting for the terminal","directories":{},"_nodeVersion":"18.16.0","dependencies":{"chalk":"^5.2.0","prismjs":"^1.29.0","string-length":"^5.0.1"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.14.0","tap":"16","ts-node":"^10.9.1","typedoc":"^0.24.7","prettier":"^2.8.6","@types/tap":"^15.0.8","typescript":"^5.0.2","@types/node":"^20.1.5","@types/prismjs":"^1.26.0"},"_npmOperationalInternal":{"tmp":"tmp/prismjs-terminal_1.0.0_1685900129187_0.5178668973962761","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"prismjs-terminal","version":"1.2.0","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"prismjs-terminal@1.2.0","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/prismajs-term#readme","bugs":{"url":"https://github.com/isaacs/prismajs-term/issues"},"tap":{"ts":false,"color":true,"coverage":false,"node-arg":["--no-warnings","--loader","ts-node/esm"],"test-arg":["--color=full"],"test-env":["FORCE_COLOR=3"]},"dist":{"shasum":"ac9fb5ca4bdcea32e8e6da30aeda7becee1c9b72","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.2.0.tgz","fileCount":35,"integrity":"sha512-zISM2WaZBnvam3eotb2m6iRCVyrgs3eXL4jHiBiJTr+0cqZPsSUbzLGZpbXtPWYFT59mPKNK3SuAdAE2rTU2zg==","signatures":[{"sig":"MEUCIQC07NjdnP7fj6/EC8SbvsBpCoUU03n77VwmOJLQ0yWcrgIgB+8sDHdRKZhkmLHvfNS8Vy8bhwUErC75qxMLDP+21Hk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":56293},"type":"module","module":"./dist/index.js","engines":{"node":">=14"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./themes":{"import":{"types":"./dist/themes/index.d.ts","default":"./dist/themes/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"7ec32d183f9d71a2b2c68a68a8cff751e4dcf247","scripts":{"snap":"c8 tap","test":"c8 tap","format":"prettier --write . --loglevel warn","prepare":"tsc && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"endOfLine":"lf","printWidth":75,"arrowParens":"avoid","singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true},"repository":{"url":"git+https://github.com/isaacs/prismajs-term.git","type":"git"},"_npmVersion":"9.6.7","description":"PrismaJS syntax highlighting for the terminal","directories":{},"_nodeVersion":"18.16.0","dependencies":{"chalk":"^5.2.0","prismjs":"^1.29.0","string-length":"^5.0.1"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.14.0","tap":"16","ts-node":"^10.9.1","typedoc":"^0.24.7","prettier":"^2.8.6","@types/tap":"^15.0.8","typescript":"^5.0.2","@types/node":"^20.1.5","@types/prismjs":"^1.26.0"},"_npmOperationalInternal":{"tmp":"tmp/prismjs-terminal_1.2.0_1685905254655_0.13698757582138166","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"prismjs-terminal","version":"1.2.1","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"prismjs-terminal@1.2.1","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/prismajs-terminal#readme","bugs":{"url":"https://github.com/isaacs/prismajs-terminal/issues"},"tap":{"ts":false,"color":true,"coverage":false,"node-arg":["--no-warnings","--loader","ts-node/esm"],"test-arg":["--color=full"],"test-env":["FORCE_COLOR=3"]},"dist":{"shasum":"eeb0cea18601d6b161fee65e83baadede0a86e88","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.2.1.tgz","fileCount":35,"integrity":"sha512-/P/evXr8P9yZLmz/41LnHZ1Fv4FJEj+mq4EcOh7MYnuQKsBEQKp9JttiVc+4tYyfSd2dw1CnWaKskPF/yVJfaQ==","signatures":[{"sig":"MEUCIC/FmUD7ooym4fl5+5pDZVQvUG2Vy+Mv80/EMbAlPq7sAiEAvNKMcvSdw4izpo8eu9IJZwhO0VIdtx1OMjJ2WgXm41g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67034},"type":"module","module":"./dist/index.js","engines":{"node":">=16"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./themes":{"import":{"types":"./dist/themes/index.d.ts","default":"./dist/themes/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"96b16e6255df806a788d9dbca4186da5f9e674cf","scripts":{"snap":"c8 tap","test":"c8 tap","format":"prettier --write . --loglevel warn","prepare":"tsc && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc ./src/*.ts","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"endOfLine":"lf","printWidth":75,"arrowParens":"avoid","singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true},"repository":{"url":"git+https://github.com/isaacs/prismajs-terminal.git","type":"git"},"_npmVersion":"9.6.7","description":"PrismaJS syntax highlighting for the terminal","directories":{},"_nodeVersion":"18.16.0","dependencies":{"chalk":"^5.2.0","prismjs":"^1.29.0","string-length":"^5.0.1"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.14.0","tap":"16","ts-node":"^10.9.1","typedoc":"^0.24.7","prettier":"^2.8.6","@types/tap":"^15.0.8","typescript":"^5.0.2","@types/node":"^20.1.5","@types/prismjs":"^1.26.0"},"_npmOperationalInternal":{"tmp":"tmp/prismjs-terminal_1.2.1_1685916998042_0.11213063536386847","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"prismjs-terminal","version":"1.2.2","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"prismjs-terminal@1.2.2","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/prismajs-terminal#readme","bugs":{"url":"https://github.com/isaacs/prismajs-terminal/issues"},"tap":{"ts":false,"color":true,"coverage":false,"node-arg":["--no-warnings","--loader","ts-node/esm"],"test-arg":["--color=full"],"test-env":["FORCE_COLOR=3"]},"dist":{"shasum":"1a8bb26e60fd4c5baf89ed6287def6ba50d75cd7","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.2.2.tgz","fileCount":35,"integrity":"sha512-4R8ub11GPQzsmLjFbOulmEho30GvhrRPsQUCz9cZd7yM9JKBItGeF7nCpQtByyC2tGxBHA+gU3WHGXECNTOG/g==","signatures":[{"sig":"MEUCIQCKqjL0gwiIQIT1bjiXicRxn+Ht3Jjsoq0qPE8hPvG9BAIgPQL+MY7jO7/F28IJnhkxFX78F64YhiRB+WBY74V9hJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67034},"type":"module","module":"./dist/index.js","engines":{"node":">=16"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./themes":{"import":{"types":"./dist/themes/index.d.ts","default":"./dist/themes/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"a1934e83bb45dc98242c576f5b5d3d2a1eb890fe","scripts":{"snap":"c8 tap","test":"c8 tap","format":"prettier --write . --loglevel warn","prepare":"tsc && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc ./src/*.ts","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"endOfLine":"lf","printWidth":75,"arrowParens":"avoid","singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true},"repository":{"url":"git+https://github.com/isaacs/prismajs-terminal.git","type":"git"},"_npmVersion":"9.5.1","description":"PrismaJS syntax highlighting for the terminal","directories":{},"_nodeVersion":"18.16.0","dependencies":{"chalk":"^5.2.0","prismjs":"^1.29.0","string-length":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.14.0","tap":"16","ts-node":"^10.9.1","typedoc":"^0.24.7","prettier":"^2.8.6","@types/tap":"^15.0.8","typescript":"^5.0.2","@types/node":"^20.1.5","@types/prismjs":"^1.26.0"},"_npmOperationalInternal":{"tmp":"tmp/prismjs-terminal_1.2.2_1687025893526_0.4772362455491117","host":"s3://npm-registry-packages"}},"1.2.3":{"name":"prismjs-terminal","version":"1.2.3","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"url":"https://blog.izs.me","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"prismjs-terminal@1.2.3","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/prismajs-terminal#readme","bugs":{"url":"https://github.com/isaacs/prismajs-terminal/issues"},"tap":{"ts":false,"color":true,"coverage":false,"node-arg":["--no-warnings","--loader","ts-node/esm"],"test-arg":["--color=full"],"test-env":["FORCE_COLOR=3"]},"dist":{"shasum":"ece78c1c19fe73694ca609a7aee2b3d4de926d4c","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.2.3.tgz","fileCount":35,"integrity":"sha512-xc0zuJ5FMqvW+DpiRkvxURlz98DdfDsZcFHdO699+oL+ykbFfgI7O4VDEgUyc07BSL2NHl3zdb8m/tZ/aaqUrw==","signatures":[{"sig":"MEQCIE8hdmYaKkgA8j33z8XMuMKytnM8aINvYA5+MA8luKgGAiBqoQ0u0W0ox/ljj0RgAWNX/1qZubxCDCjpsg17NRVkRQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67270},"type":"module","module":"./dist/index.js","engines":{"node":">=16"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./themes":{"import":{"types":"./dist/themes/index.d.ts","default":"./dist/themes/index.js"}},"./package.json":{"import":"./package.json","require":"./package.json"}},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"c38a20966908e669ef8da17981b17e0dc5659717","scripts":{"snap":"c8 tap","test":"c8 tap","format":"prettier --write . --loglevel warn","prepare":"tsc && bash ./scripts/fixup.sh","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc ./src/*.ts","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"endOfLine":"lf","printWidth":75,"arrowParens":"avoid","singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true},"repository":{"url":"git+https://github.com/isaacs/prismajs-terminal.git","type":"git"},"_npmVersion":"9.8.1","description":"PrismaJS syntax highlighting for the terminal","directories":{},"_nodeVersion":"20.6.1","dependencies":{"chalk":"^5.2.0","prismjs":"^1.29.0","string-length":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^7.14.0","tap":"16","ts-node":"^10.9.1","typedoc":"^0.24.7","prettier":"^2.8.6","@types/tap":"^15.0.8","typescript":"^5.0.2","@types/node":"^20.1.5","@types/prismjs":"^1.26.0"},"_npmOperationalInternal":{"tmp":"tmp/prismjs-terminal_1.2.3_1694804853508_0.8465920779173295","host":"s3://npm-registry-packages"}},"1.2.4":{"name":"prismjs-terminal","version":"1.2.4","description":"PrismJS syntax highlighting for the terminal","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://blog.izs.me"},"type":"module","module":"./dist/esm/index.js","tshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./themes":"./src/themes/index.ts"},"selfLink":false},"license":"BlueOak-1.0.0","scripts":{"preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","prepare":"tshy","pretest":"npm run prepare","presnap":"npm run prepare","test":"tap","snap":"tap","format":"prettier --write . --log-level warn","typedoc":"typedoc"},"devDependencies":{"@types/node":"^24.10.1","@types/prismjs":"^1.26.5","prettier":"^2.8.6","tap":"^21.1.6","tshy":"^3.1.0","typedoc":"^0.28.14"},"engines":{"node":">=16"},"funding":{"url":"https://github.com/sponsors/isaacs"},"repository":{"type":"git","url":"git+https://github.com/isaacs/prismjs-terminal.git"},"dependencies":{"chalk":"^5.2.0","prismjs":"^1.30.0","string-length":"^6.0.0"},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./themes":{"import":{"types":"./dist/esm/themes/index.d.ts","default":"./dist/esm/themes/index.js"},"require":{"types":"./dist/commonjs/themes/index.d.ts","default":"./dist/commonjs/themes/index.js"}}},"main":"./dist/commonjs/index.js","types":"./dist/commonjs/index.d.ts","gitHead":"fd7187ead3c046f8722c39f8c39f0c55de81f4fa","_id":"prismjs-terminal@1.2.4","bugs":{"url":"https://github.com/isaacs/prismjs-terminal/issues"},"homepage":"https://github.com/isaacs/prismjs-terminal#readme","_nodeVersion":"24.4.1","_npmVersion":"11.6.3","dist":{"integrity":"sha512-S2nsjy6s2x2jF4uTW8ulX19rvmRfe9R1wmnNwI5wmBgQEErB0vuKueVPMzN6KsFRCCJ2IQrWUS0BqhcNsrR9xg==","shasum":"e79747acdf428bda8ea56efb81d75f699bdb0657","tarball":"https://registry.npmjs.org/prismjs-terminal/-/prismjs-terminal-1.2.4.tgz","fileCount":69,"unpackedSize":130632,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFtyEJ5GpGIarBcFmF/QPAJAOnd0SBZsMWaaYaYaz1RhAiEAgV9HNzfeJOb+VWO1GqItp03bcsufmu1jdxc+qJVGubI="}]},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":"i@izs.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prismjs-terminal_1.2.4_1764045456523_0.8258756456918721"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-04T17:35:29.100Z","modified":"2025-11-25T04:37:36.887Z","1.0.0":"2023-06-04T17:35:29.389Z","1.2.0":"2023-06-04T19:00:54.841Z","1.2.1":"2023-06-04T22:16:38.293Z","1.2.2":"2023-06-17T18:18:13.726Z","1.2.3":"2023-09-15T19:07:33.752Z","1.2.4":"2025-11-25T04:37:36.706Z"},"bugs":{"url":"https://github.com/isaacs/prismjs-terminal/issues"},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://blog.izs.me"},"license":"BlueOak-1.0.0","homepage":"https://github.com/isaacs/prismjs-terminal#readme","keywords":["terminal","code","syntax","highlight","highlighter","highlighting","hilite","cli"],"repository":{"type":"git","url":"git+https://github.com/isaacs/prismjs-terminal.git"},"description":"PrismJS syntax highlighting for the terminal","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"readme":"# prismjs-terminal\n\n[PrismJS](https://prismjs.com), but for terminal output.\n\n## USAGE\n\n```js\n// ESM only, sorry, blame chalk\n// But less reason to use CommonJS for new CLI apps anyway\nimport { highlight } from 'prismjs-terminal'\n\n// get some code somehow\nimport { readFileSync } from 'fs'\nconst code = readFileSync('some-file.ts', 'utf8')\n\n// highlight it\nconsole.log(highlight(code, 'typescript'))\n```\n\n## Custom Themes\n\nInstead of CSS, themes are defined using an object with\nstyling functions that take a string and return a string.\n\nThe `_` style rule applies to the block as a whole, and is used\nas the default style. This is where you'd usually port a PrismJS\ntheme's `code[class*=\"language-\"]` css rule.\n\nThe `lineNumber` style rule will apply to line numbers, if they\nare used.\n\nThe semantics are similar to CSS, where a nested property will be\napplied to nodes within that nesting stack with a higher\npriority the more tags that match, and later rules taking\nprecedence over earlier ones. It's _not_ a full CSS selector\nsyntax though, so things like `.token.italic.bold` aren't\nsupported. Just individual token class names, possibly nested.\nAlso, chalk is not CSS, and a terminal is not a browser, so\nthere are some differences and limitations of course.\n\nAliases are also not supported, styles have to be applied to the\nactual parsed class names PrismJS provides.\n\nFor example:\n\n```js\nimport { defaultTheme, Theme } from 'prismjs-terminal'\nimport chalk from 'chalk'\nconst theme: Theme = {\n  // any (s:string)=>string function is allowed\n  comment: chalk.hex('#d75fff').italic,\n\n  // can provide multiple functions, which is useful if they\n  // aren't chainable chalk methods\n  function: [chalk.hex('#f08'), s => ` >${s}< `],\n\n  // nest by separating with a space\n  // will turn `/abc/gm` into:\n  // chalk.bold('/' + chalk.green('abc') + '/' + chalk.blue('gm'))\n  regex: chalk.bold,\n  'regex regex-source': chalk.green,\n  'regex regex-flags': chalk.blue,\n\n  // apply one style to multiple token names by separating with `,`\n  'string, number': chalk.green,\n\n  // See the defaultTheme export for more examples.\n}\nconsole.log(highlight(code, 'typescript', { theme }))\n\n// can also use one of the included ones\nconsole.log(highlight(code, 'typescript', { theme: 'xonokai' }))\n```\n\nSee [the themes directory in this repo](./themes) for more\nexamples.\n\n## API\n\n- interface `PrismJSTerminalOpts`\n\n  - `theme` The theme to use. Either a Theme object, or a\n    string identifying one of the built-in themes. Defaults to\n    `'moria'`.\n  - `language` The language of the supplied code to highlight.\n    Defaults to `tsx` if no filename is provided, or else\n    tries to infer the language from the filename. You must\n    have previously called `loadLanguages([...])` from\n    `PrismJS` in order to highlight a given language, if you\n    want something that is not automatically included when\n    `tsx` and `typescript` are included.\n  - `minWidth` The minimum width to make the block on the\n    screen. Defaults to `0`.\n  - `maxWidth` The maximum width to make the block on the\n    screen. Defaults to `process.stdout.columns` or `80`.\n  - `padding` How many spaces to horizontally pad the code\n    block. Defaults to `1`.\n  - `lineNumbers` Whether or not to prepend a line number to each\n    line. Defaults to `false`.\n\n- `highlight(code: string, opts?: PrismJSTerminalOpts): string`\n\n  Highlight the string of code provided, returning the string of\n  highlighted code.\n\n- `highlightFile(filename: string, opts?: PrismJSTerminalOpts): Promise<string>`\n\n  Read the filename provided, and highlight its code. If a\n  language is not provided in the opts, it will attempt to infer\n  from the filename.\n\n- `highlightFileSync(filename: string, opts?: PrismJSTerminalOpts): string`\n\n  Synchronous `highlightFile`.\n\n- Themes:\n\n  More are welcome! If you have a PrismJS theme you like, do\n  send a PR. Of course not everything translates, but it's quite\n  straightforward to take a PrismJS CSS file and turn all the\n  `color: #...` lines into `chalk.hex('#...')` calls.\n\n  Theme objects can be either a Map or object where the keys are\n  the selectors and the values are either a styling function or\n  an array of styling functions to be applied in order.\n\n  - `debug` This just dumps the code wrapped in `<tag>...</tag>`\n    to see what the token names are. Useful for tests and such.\n  - `plain` No styling, just the code as plain text.\n  - `github` Port of GHColors prismjs theme.\n  - `moria` Inspired by Vim Moria color scheme.\n  - `prismDark` Port of the `prism-dark` PrismJS theme.\n  - `xonokai` Port of the `xonokai` PrismJS theme.\n","readmeFilename":"README.md"}