On 5 Nov 2014, at 21:17, soeren.vogel@posteo.ch wrote:

How can I achieve syntax highlight for pandoc (multimarkdown) title elements (starting with '% Some title')?

The manual explains the system: http://manual.macromates.com/en/language_grammars

Matt Neuburg did a supplement: http://www.apeth.com/nonblog/stories/textmatebundle.html

The current rule for # Some title in Markdown is:

name = 'markup.heading.${1/(#)(#)?(#)?(#)?(#)?(#)?/${6:?6:${5:?5:${4:?4:${3:?3:${2:?2:1}}}}}/}.markdown';
begin = '(?:^|\G)(#{1,6})\s*(?=[\S[^#]])';
end = '\s*(#{1,6})?$\n?';
captures = { 1 = { name = 'punctuation.definition.heading.markdown'; }; };
contentName = 'entity.name.section.markdown';
patterns = ( { include = '#inline'; } );

The long format string in the name (${1/(#)(#)?(#)?(#)?(#)?(#)?/${6:?6:${5:?5:${4:?4:${3:?3:${2:?2:1}}}}}/}) is to convert the span if #’s to an integer (you probably don’t need that).