[TxMt] Re: Trying to match triple-backticks
Allan Odgaard
mailinglist at textmate.org
Sun Jan 10 22:37:44 UTC 2016
On 8 Jan 2016, at 9:18, Martin Kühl wrote:
> Thinking about this more, I believe this is a bug.
> The `L:` prefix seems to cause the injected begin matcher
> to match even before its own end matcher can,
The `L:` prefix means “inject the rules before the current context’s
rules”.
What happens here is that we inject a begin/end match, each for `~~~`.
Once we match `~~~` we start a new context, in this new context, the
injection grammar is once again injected, so once we see the ending
`~~~` it is actually matched by a new instance of the injection grammar,
because we inject it before the current context’s rules (in which we
find the rule to match the ending `~~~`).
So one solution is to remove the `L:` prefix so that we check the
current context’s rules before the injection grammar’s.
Another solution is to make the scope selector: `L:(text.html.markup $)`
to only inject the rules when we are at the root level of the document.
Alternatively `L:(text.html.markup - markup.raw.block.markdown)` to just
avoid injecting it into fenced code blocks.
More information about the textmate
mailing list