wooorm / starry-night

Syntax highlighting, like GitHub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`flagToGrammar()`?

bencmbrook opened this issue · comments

It'd be useful to be able to grab the grammar object without copying and pasting the flagToScope algorithm. This is useful to get metadata about the grammar, such as to display the language in a code block.

Any interest in adding this method?

Why not use starryNight.flagToScope(flag) // scope, and then look up the scope in the grammars? You already pass an array of grammars to starry-night right? So you have the data you want?

Ah, I see now! That works well, thanks @wooorm !