Converts source code filenames to PrismJS language aliases.
$ npm i filename2prism
Map a file extension to its associated PrismJS language aliases:
The following reads a directory of source code files, highlights them according to their filenames, and then outputs the results to another directory:
const path =const fs =const filename2prism =const prism =// Loads all languagesconst src = 'path/to/some/src/dir'const out = 'path/to/some/out/dir'fs
filename2prism(filename) -> string | Array<string> | undefined
Returns a PrismJS language alias from a filename. A
string is returned if there was one match, an
Array<string> is returned if there were multiple matches, and
undefined is returned if there was no match.
string- The filename to infer a PrismJS alias from.