[TxMt] Re: Trying to match triple-backticks

Martin Kühl martin.kuehl at gmail.com
Thu Jan 7 15:53:11 UTC 2016


On 7 January 2016 at 14:00, Mike McQuaid <mike at mikemcquaid.com> wrote:
> Hi!
>
> I’m trying to match the triple-backticks raw block Markdown extension e.g.:
>
> ```
> this is a raw block
> ```
>
>
> I’m using the following pattern:
>
>                 {       name = 'markup.raw.block.markdown';
>                         begin = '(^|\G)([`~]{3,})';
>                         end = '(^|\G)([`~]{3,})';
>                         beginCaptures = { 2 = { name = 'punctuation.definition.raw.markdown'; }; };
>                 },
>
> Unfortunately this just seems to never “end” and just matches the “begin” repeatedly.

Interesting, that does work for me.

For completeness sake, this is in the grammar repository:

    raw_block = {
        patterns = (
            {   name = 'markup.raw.block.markdown';
                begin = '(^|\G)([ ]{4}|\t)';
                while = '(^|\G)([ ]{4}|\t)';
            },
            {   name = 'markup.raw.block.fenced.markdown';
                begin = '(^|\G)([`~]{3,})';
                end = '(^|\G)([`~]{3,})';
                beginCaptures = { 2 = { name =
'punctuation.definition.raw.markdown'; }; };
            },
        );
    };

and I tested with this snippet of text:

    This is some text

        This is a raw block

    ```
    This is another raw block
    ```

    This is some more text

Both raw blocks are recognized as such, as are both paragraphs.

Is your TextMate up to date? (2.0-beta.8.5 is the latest "normal" release.)
Have you made any other modifications to your Markdown bundle?

Sorry,
Martin

> Does anyone have any suggestions here?
>
> Thanks!
>
> Mike McQuaid
> http://mikemcquaid.com
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate


More information about the textmate mailing list