closetag.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Close-Tag Demo</title>
  6. <link rel="stylesheet" href="../lib/codemirror.css">
  7. <script src="../lib/codemirror.js"></script>
  8. <script src="../addon/edit/closetag.js"></script>
  9. <script src="../mode/xml/xml.js"></script>
  10. <script src="../mode/javascript/javascript.js"></script>
  11. <script src="../mode/css/css.js"></script>
  12. <script src="../mode/htmlmixed/htmlmixed.js"></script>
  13. <link rel="stylesheet" href="../doc/docs.css">
  14. <style type="text/css">
  15. .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
  16. </style>
  17. </head>
  18. <body>
  19. <h1>Close-Tag Demo</h1>
  20. <ul>
  21. <li>Type an html tag. When you type '>' or '/', the tag will auto-close/complete. Block-level tags will indent.</li>
  22. <li>There are options for disabling tag closing or customizing the list of tags to indent.</li>
  23. <li>Works with "text/html" (based on htmlmixed.js or xml.js) mode.</li>
  24. <li>View source for key binding details.</li>
  25. </ul>
  26. <form><textarea id="code" name="code"><html</textarea></form>
  27. <script type="text/javascript">
  28. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  29. mode: 'text/html',
  30. autoCloseTags: true
  31. });
  32. </script>
  33. </body>
  34. </html>