| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: Html Embedded Scripts mode</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 |
<script src="../../lib/codemirror.js"></script> |
| 9 |
<script src="../xml/xml.js"></script> |
| 10 |
<script src="../javascript/javascript.js"></script> |
| 11 |
<script src="../css/css.js"></script> |
| 12 |
<script src="../htmlmixed/htmlmixed.js"></script> |
| 13 |
<script src="htmlembedded.js"></script> |
| 14 |
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> |
| 15 |
<div id=nav> |
| 16 |
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a> |
| 17 |
|
| 18 |
<ul> |
| 19 |
<li><a href="../../index.html">Home</a> |
| 20 |
<li><a href="../../doc/manual.html">Manual</a> |
| 21 |
<li><a href="https://github.com/marijnh/codemirror">Code</a> |
| 22 |
</ul> |
| 23 |
<ul> |
| 24 |
<li><a href="../index.html">Language modes</a> |
| 25 |
<li><a class=active href="#">Html Embedded Scripts</a> |
| 26 |
</ul> |
| 27 |
</div> |
| 28 |
|
| 29 |
<article> |
| 30 |
<h2>Html Embedded Scripts mode</h2> |
| 31 |
<form><textarea id="code" name="code"> |
| 32 |
<% |
| 33 |
function hello(who) { |
| 34 |
return "Hello " + who; |
| 35 |
} |
| 36 |
%> |
| 37 |
This is an example of EJS (embedded javascript) |
| 38 |
<p>The program says <%= hello("world") %>.</p> |
| 39 |
<script> |
| 40 |
alert("And here is some normal JS code"); // also colored |
| 41 |
</script> |
| 42 |
</textarea></form> |
| 43 |
|
| 44 |
<script> |
| 45 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 46 |
lineNumbers: true, |
| 47 |
mode: "application/x-ejs", |
| 48 |
indentUnit: 4, |
| 49 |
indentWithTabs: true, |
| 50 |
enterMode: "keep", |
| 51 |
tabMode: "shift" |
| 52 |
}); |
| 53 |
</script> |
| 54 |
|
| 55 |
<p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on |
| 56 |
JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p> |
| 57 |
|
| 58 |
<p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET), |
| 59 |
<code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p> |
| 60 |
</article> |
| 61 |
|