Open suryasaha opened 7 years ago
Yes, this is possible. GitHub has a project called Linguist that guesses the language directly from the syntax.
Luckily, Linguist uses a set of language grammars that are language-agnostic, so this can be implemented in a similar manner.
So when can we expect your PR implementing this? 😜
This is already supported by the syntax. You just have to have colors assigned to the scope.
Add color(s) to your active .tmTheme
file for the scope of a generic fenced code block, which is text.html.markdown markup.raw.block.markdown markup.raw.block.fenced.markdown
(from Tools > Developer > Show scope name).
So, for example, this makes it green on light grey:
<dict>
<key>name</key>
<string>Markup: Raw (code) block</string>
<key>scope</key>
<string>markup.raw.block</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#aaffaad0</string>
<key>background</key>
<string>#222</string>
</dict>
</dict>
I think there's a way to edit a .yaml
file to do the same thing, but I can't remember right now and I know this works.
Try out different color schemes (themes) 'til you find one that already has something like this implemented. Look in Package Control.
(Looks like issue #108 has a suggestion near the bottom.)
Is it possible to highlight a generic fenced code block like the one below? This is useful when the language is not specified.