[TxMt] Re: Pandoc Title Syntax Highlight

Allan Odgaard mailinglist at textmate.org
Thu Nov 6 11:13:51 UTC 2014


On 5 Nov 2014, at 21:17, soeren.vogel at 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).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20141106/a7ed04d2/attachment.html>


More information about the textmate mailing list