index.html 1.9 KB

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