9

Is it possible to create a syntax highlighting ruleset for EE template code snippets? I couldn't find any documentation that described at what point in the community's lifetime that such features could be added.

If we can add it, how does one go about it? If we can't yet, at what point can we?

  • 3
    Does such a syntax-highlighting product already exist (preferably open source or otherwise adaptable)? I cannot promise anything, but this will greatly increase the likelihood that such a feature could ever be implemented. There is no specific time frame where such features are considered explicitly. Its going to depend largely on the resources available vs. how widely such a product will be used and what it adds overall. – Robert Cartaino Nov 16 '12 at 1:42
  • Robert, there's a sublime text package for ExpressionEngine that has syntax highlighting. – CreateSean Nov 16 '12 at 1:47
  • 1
    There are a couple I'm aware of. There's this TextMate bundle which includes some regexes for matching tags (although, inside an XML format): github.com/wesbaker/ExpressionEngine2.tmbundle There's also this Geshi-spefic set of highlighting rules which might be easier to dig through: mithra62.com/blog/view/introducing-ee-syntax – Gavin Anderegg Nov 16 '12 at 1:52
  • Honestly, any PHP or HTML highlighter (like you have on Stack Overflow) would get us 80% of the way there. A full EE syntax highlighter would be lovely, but I'd be happy with something simple in the meantime. – Adrian Macneil Nov 16 '12 at 3:40
  • Don't know if this will help... I use this: EE 2 Syntax Mode for Coda 2. Coda 2 has a 7-day trial... which is what I did (testing the above) before buying. – notacouch Nov 21 '12 at 17:26
  • That would be awesome. It would certainly make the code snippets in questions and answers much better. I guess this would be something SE would have to implement rather than us though surely? – JohnWBaxter Nov 25 '12 at 0:54
  • 1
    I agree, we definitely need some EE-specific syntax highlighting. There need to be specific colors for EE tags, parameter values, and comments. I use the Sublime Text package and it works pretty well. – kmgdev Dec 20 '12 at 17:13
3

Prism.js is the best syntax highlighting script IMO. It's super lightweight and really easy to build new syntax modes for it.

Take a look at my Prism.js highlighter for EE. https://github.com/objectivehtml/prismjs-for-expressionengine

<pre class="language-ee"><code>

    {exp:channel:entries}

        {title}

    {/exp:channel:entries}

</code></pre>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .