48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!doctype html>
 | |
| 
 | |
| <title>CodeMirror: Match Highlighter Demo</title>
 | |
| <meta charset="utf-8"/>
 | |
| <link rel=stylesheet href="../doc/docs.css">
 | |
| 
 | |
| <link rel="stylesheet" href="../lib/codemirror.css">
 | |
| <script src="../lib/codemirror.js"></script>
 | |
| <script src="../addon/search/searchcursor.js"></script>
 | |
| <script src="../addon/search/match-highlighter.js"></script>
 | |
| <style type="text/css">
 | |
|       .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
 | |
|       .CodeMirror-focused .cm-matchhighlight {
 | |
|         background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
 | |
|         background-position: bottom;
 | |
|         background-repeat: repeat-x;
 | |
|       }
 | |
|     </style>
 | |
| <div id=nav>
 | |
|   <a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a>
 | |
| 
 | |
|   <ul>
 | |
|     <li><a href="../index.html">Home</a>
 | |
|     <li><a href="../doc/manual.html">Manual</a>
 | |
|     <li><a href="https://github.com/marijnh/codemirror">Code</a>
 | |
|   </ul>
 | |
|   <ul>
 | |
|     <li><a class=active href="#">Match Highlighter</a>
 | |
|   </ul>
 | |
| </div>
 | |
| 
 | |
| <article>
 | |
| <h2>Match Highlighter Demo</h2>
 | |
| <form><textarea id="code" name="code">Select this text: hardToSpotVar
 | |
| 	And everywhere else in your code where hardToSpotVar appears will automatically illuminate.
 | |
| Give it a try!  No more hardToSpotVars.</textarea></form>
 | |
| 
 | |
|     <script>
 | |
| var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
 | |
|   lineNumbers: true,
 | |
|   highlightSelectionMatches: {showToken: /\w/}
 | |
| });
 | |
| </script>
 | |
| 
 | |
|     <p>Search and highlight occurences of the selected text.</p>
 | |
| 
 | |
|   </article>
 | 
