Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-language syntax highlighting in Atom

I am doing a project where I have files which have markdown and perl in it. I would like to be able to syntax highlight both of them, is it possible in atom?

like image 465
Pushpinder Singh Avatar asked Oct 17 '22 12:10

Pushpinder Singh


1 Answers

It is possible, but it is not perfect.

There is a well-written post about this on discuss.atom.io. Basically, you have to manually edit the language package (like language-markdown or language-perl) and add an extra grammar rule by referring to another language.

For example, adding

{
    'begin': '`'
    'beginCaptures':
      '0':
        'name': 'punctuation.definition.string.begin.coffee'
    'end': '`'
    'endCaptures':
      '0':
        'name': 'punctuation.definition.string.end.coffee'
    'name': 'string.quoted.script.coffee'
    'patterns': [
      {
        'include': 'source.js'
      }
    ]
  }

to language-coffee-script enables syntax-highlighting of javascript between two instances of (`).

like image 76
Exercise To The Reader Avatar answered Oct 21 '22 04:10

Exercise To The Reader