1
0

matchhighlighter.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Match Highlighter Demo</title>
  6. <link rel="stylesheet" href="../lib/codemirror.css">
  7. <script src="../lib/codemirror.js"></script>
  8. <script src="../addon/search/searchcursor.js"></script>
  9. <script src="../addon/search/match-highlighter.js"></script>
  10. <link rel="stylesheet" href="../doc/docs.css">
  11. <style type="text/css">
  12. .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
  13. .CodeMirror-focused .cm-matchhighlight {
  14. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
  15. background-position: bottom;
  16. background-repeat: repeat-x;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <h1>CodeMirror: Match Highlighter Demo</h1>
  22. <form><textarea id="code" name="code">Select this text: hardToSpotVar
  23. And everywhere else in your code where hardToSpotVar appears will automatically illuminate.
  24. Give it a try! No more hardToSpotVars.</textarea></form>
  25. <script>
  26. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  27. lineNumbers: true,
  28. highlightSelectionMatches: true
  29. });
  30. </script>
  31. <p>Search and highlight occurences of the selected text.</p>
  32. </body>
  33. </html>