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