Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        


filename2prism



version


CI


gzip size


brotli size


Sponsor


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)