2
0

index.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Html Embedded Scripts mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../xml/xml.js"></script>
  9. <script src="../javascript/javascript.js"></script>
  10. <script src="../css/css.js"></script>
  11. <script src="../htmlmixed/htmlmixed.js"></script>
  12. <script src="htmlembedded.js"></script>
  13. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  14. <link rel="stylesheet" href="../../doc/docs.css">
  15. </head>
  16. <body>
  17. <h1>CodeMirror: Html Embedded Scripts mode</h1>
  18. <form><textarea id="code" name="code">
  19. <%
  20. function hello(who) {
  21. return "Hello " + who;
  22. }
  23. %>
  24. This is an example of EJS (embedded javascript)
  25. <p>The program says <%= hello("world") %>.</p>
  26. <script>
  27. alert("And here is some normal JS code"); // also colored
  28. </script>
  29. </textarea></form>
  30. <script>
  31. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  32. lineNumbers: true,
  33. mode: "application/x-ejs",
  34. indentUnit: 4,
  35. indentWithTabs: true,
  36. enterMode: "keep",
  37. tabMode: "shift"
  38. });
  39. </script>
  40. <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
  41. JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
  42. <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
  43. <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
  44. </body>
  45. </html>