Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cowboy/615538 to your computer and use it in GitHub Desktop.
Save cowboy/615538 to your computer and use it in GitHub Desktop.
TextMate + Zen Coding + SyntaxHighlighter + this = yay
{ name = 'source.css.embedded.html.syntaxhighlighter';
begin = '(?:^\s+)?(<)((?i:pre))\b(?=[^>]*class=([''"])[^>]*?\bbrush\s*:\s*css\b[^>]*?\3)(?![^>]*/>)';
end = '(?<=</(pre|PRE))(>)(?:\s*\n)?';
beginCaptures = {
1 = { name = 'punctuation.definition.tag.html'; };
2 = { name = 'entity.name.tag.style.html'; };
};
endCaptures = { 2 = { name = 'punctuation.definition.tag.html'; }; };
patterns = (
{ include = '#tag-stuff'; },
{ begin = '(>)';
end = '(?=</(?i:pre))';
beginCaptures = { 1 = { name = 'punctuation.definition.tag.html'; }; };
patterns = (
{ include = '#embedded-code'; },
{ include = 'source.css'; },
);
},
);
},
{ name = 'source.js.jquery.embedded.html.syntaxhighlighter';
begin = '(?:^\s+)?(<)((?i:pre))\b(?=[^>]*class=([''"])[^>]*?\bbrush\s*:\s*js\b[^>]*?\3)(?![^>]*/>)';
end = '(?<=</(pre|PRE))(>)(?:\s*\n)?';
beginCaptures = {
1 = { name = 'punctuation.definition.tag.html'; };
2 = { name = 'entity.name.tag.script.html'; };
};
endCaptures = { 2 = { name = 'punctuation.definition.tag.html'; }; };
patterns = (
{ include = '#tag-stuff'; },
{ begin = '(?<!</(?:pre|PRE))(>)';
end = '(</)((?i:pre))';
captures = {
1 = { name = 'punctuation.definition.tag.html'; };
2 = { name = 'entity.name.tag.script.html'; };
};
patterns = (
{ name = 'comment.line.double-slash.js';
match = '(//).*?((?=</script)|$\n?)';
captures = { 1 = { name = 'punctuation.definition.comment.js'; }; };
},
{ name = 'comment.block.js';
begin = '/\*';
end = '\*/|(?=</script)';
captures = { 0 = { name = 'punctuation.definition.comment.js'; }; };
},
{ include = '#php'; },
{ include = 'source.js'; },
);
},
);
},
@cowboy
Copy link
Author

cowboy commented Oct 7, 2010

TextMate grammar snippet for parsing SyntaxHighlighter <pre class="brush:js"> or <pre class="brush:css"> blocks - I manually added this into the Zen Coding HTML Zen language grammar like so:

http://benalman.com/grab/e997a1.png

This is a really quick hack, please fork it and make it more awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment