Where to add custom Scope Descriptors


#1

We are working with large Markdown files for GitBooks and find that it would be helpful to have custom markdown blocks highlighted. I’ve been digging around trying to figure out how to extend the existing grammar with a couple of custom scopes.

For example: the scope cursor is at text.md for {{"ch01r1" | cite}}. I like to extend this with a pattern match so that the citation tag (similar to mustache templates) is matched and highlighted in all markdown files. The issue I have is what is the entry point for doing this? config.cson doesn’t seem to be the obvious answer, nor does init.coffee, or am I missing something obvious. The Atom.io documentation has a section on Scoped Settings, Scopes and Scope Descriptors but doesn’t make clear where to extend from.

Another example block I want to add a scope for so that it can be highlighted:

{% fleximages %}
ch1_fig1a.jpg
ch1_fig1b.jpg
{% endfleximages %}

#2

The best way would be to make a new grammar that references the Markdown grammar (example here) and includes matching expressions for your custom tags. I have a grammar template with annotations that explains a bit about including.