[TxMt] Including / extending language grammars

Matt Foster matt.p.foster at gmail.com
Mon Nov 24 09:37:36 UTC 2008


I've just discovered the Plain Text Wiki bundle [1], and I'd like to
improve the grammar by including the markdown language, so that the
pagename scopes are just added on to markdown.
Currently, the language grammar looks like this:

{	scopeName = 'text.html.markdown.wiki';
	comment = 'TODO: Get nesting to work correctly.
	Currently, the links are only picked up outside of paragraphs.';
	fileTypes = ( 'txt', 'markdown', 'mdown', 'markdn', 'md' );
	patterns = (
		{	include = '#delimited'; },
		{	include = '#camelcase'; },
		{	include = 'text.html.markdown'; },
	);
	repository = {
		camelcase = {
			name = 'markup.other.pagename.camelcase';
			match = '[A-Z][a-z]+([A-Z][a-z]*)+';
		};
		delimited = {
			contentName = 'markup.other.pagename.delimited';
			begin = '\[\[';
			end = '\]\]';
		};
	};
}

This includes the markdown grammar, but breaks everything else that is
in a paragraph.

I'm fairly sure I'm missing something simple, but can anyone help me out?

Cheers,

Matt

[1]: http://interconnected.org/home/more/2007/05/textmate-wiki/

PS. I've made a fork at:
http://github.com/mattfoster/plaintextwiki-tmbundle/ if anyone's
interested.

-- 
Matt Foster | http://hackerific.net



More information about the textmate mailing list