[TxMt] Re: Strange highlighting for Ruby embedded in Markdown

Allan Odgaard mailinglist at textmate.org
Mon Sep 7 19:59:49 UTC 2015


On 9 Jul 2015, at 13:30, Stefan Daschek wrote:

> I added support for fenced code blocks to the Markdown bundle as 
> described in 
> https://github.com/textmate/markdown.tmbundle/issues/15#issuecomment-18321960
>
> Then I added “meta.embedded_ruby” to the as injection scope 
> selector to the Ruby grammar.
>
> The result kind of works, but somehow the rule priority seems to get 
> mixed up (see screenshot).
>
> Any ideas how to fix this?

The problem is that the ruby grammar is injected into your scope, this 
means that whenever the ruby grammar opens a new scope, the entire ruby 
grammar will also be injected into that scope, since the scope selector 
used for the injection still match.

I think you can inject into `meta.embedded_ruby $` and it will only 
inject into the root of this sub-scope (due to the `$`) — during 
injection, the attribute scopes are currently ignored, which is why the 
tail anchor works.


More information about the textmate mailing list