Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomeraberbach/filename2prism
💎 Converts source code filenames to PrismJS language aliases.
https://github.com/tomeraberbach/filename2prism
extname filename highlight nodejs npm npm-module npm-package prism prismjs prismjs-language-aliases
Last synced: 4 months ago
JSON representation
💎 Converts source code filenames to PrismJS language aliases.
- Host: GitHub
- URL: https://github.com/tomeraberbach/filename2prism
- Owner: TomerAberbach
- License: mit
- Created: 2018-08-13T20:20:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T02:57:35.000Z (8 months ago)
- Last Synced: 2024-10-12T01:23:29.786Z (4 months ago)
- Topics: extname, filename, highlight, nodejs, npm, npm-module, npm-package, prism, prismjs, prismjs-language-aliases
- Language: TypeScript
- Homepage: https://npm.im/filename2prism
- Size: 276 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
filename2prism
Converts source code filenames to PrismJS language aliases.## Install
```sh
$ npm i filename2prism
```## Usage
Map a filename to its associated
[PrismJS language aliases](https://prismjs.com/#supported-languages):```js
import filename2prism from 'filename2prism'console.log(filename2prism(`index.mjs`))
//=> ['javascript']console.log(filename2prism(`spaghetti`))
//=> []console.log(filename2prism(`.bash_history`))
//=> ['bash']console.log(filename2prism(`file.d`))
//=> ['d', 'makefile']
```## Contributing
Stars are always welcome!
For bugs and feature requests,
[please create an issue](https://github.com/TomerAberbach/filename2prism/issues/new).## License
[MIT](https://github.com/TomerAberbach/filename2prism/blob/main/license) ©
[Tomer Aberbach](https://github.com/TomerAberbach)