Feature Idea - Embedded JavaScript Mode #520

kruncher opened this Issue Nov 20, 2011 · 4 comments


None yet
4 participants

Hello guys,

I have created a new mode for my project called "HTML + EJS" which I believe could be of benefit to others. It is literally an altered version of the HTML mode that utilises the existing JavaScript mode.

Is it possible to add configuration options to a mode? For example, EJS supports custom open and close tags. Is it possible to add a custom open / close tag option for this mode?

If there is interest for this mode I will create a pull request.



zefhemel commented Nov 21, 2011

I'm trying to understand what you did. Looking at the HTML highlight rules (https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/html_highlight_rules.js) it appears to embed the JavaScript mode already. How is what you are doing different?


ghost commented Nov 21, 2011

The additional rules allow for the following EJS:

<h1><%= document.title %></h1>
<% if (something === true) { %>
   <div>Something is true!</div>
<% } %>

I am using the EJS feature of custom open / close tags which allows me to use the following instead:

<h1><?= document.title ?></h1>
<? if (something === true) { ?>
   <div>Something is true!</div>
<? } ?>

So there would need to be a way to specify custom open / close tags within a mode instance. What would be the best way to add custom options to a specific mode?

EJS offers a similar type of syntax to that of PHP, I am not referring to the usual <script></script> elements:



zefhemel commented Nov 22, 2011

Ah sorry, I read EJS, simply as embedded JavaScript (like with script tags), but you meant the specific "templating" language, if you will.


nightwing commented May 28, 2013

ejs mode was added in #1445

nightwing closed this May 28, 2013

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