You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

7 months ago
  1. <!doctype html>
  2. <title>CodeMirror: Ruler Demo</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="../addon/display/rulers.js"></script>
  8. <style>
  9. .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
  10. </style>
  11. <div id=nav>
  12. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
  13. <ul>
  14. <li><a href="../index.html">Home</a>
  15. <li><a href="../doc/manual.html">Manual</a>
  16. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  17. </ul>
  18. <ul>
  19. <li><a class=active href="#">Ruler demo</a>
  20. </ul>
  21. </div>
  22. <article>
  23. <h2>Ruler Demo</h2>
  24. <script>
  25. var nums = "0123456789", space = " ";
  26. var colors = ["#fcc", "#f5f577", "#cfc", "#aff", "#ccf", "#fcf"];
  27. var rulers = [], value = "";
  28. for (var i = 1; i <= 6; i++) {
  29. rulers.push({color: colors[i], column: i * 10, lineStyle: "dashed"});
  30. for (var j = 1; j < i; j++) value += space;
  31. value += nums + "\n";
  32. }
  33. var editor = CodeMirror(document.body.lastChild, {
  34. rulers: rulers,
  35. value: value + value + value,
  36. lineNumbers: true
  37. });
  38. </script>
  39. <p>Demonstration of
  40. the <a href="../doc/manual.html#addon_rulers">rulers</a> addon, which
  41. displays vertical lines at given column offsets.</p>
  42. </article>