Skip to content

Instantly share code, notes, and snippets.

@aadsm
Created December 30, 2011 00:49
Show Gist options
  • Select an option

  • Save aadsm/1536976 to your computer and use it in GitHub Desktop.

Select an option

Save aadsm/1536976 to your computer and use it in GitHub Desktop.
Marked Text gets "corrupted" when there is a matching bracket
<!doctype html>
<html>
<head>
<script src="http://codemirror.net/lib/codemirror.js"></script>
<link rel="stylesheet" href="http://codemirror.net/lib/codemirror.css">
<style>
.highlight {
background-color: yellow;
}
</style>
</head>
<body>
<textarea>{"test": "here's a simple test"}</textarea>
<script>
CodeMirror.fromTextArea(document.querySelector("textarea"), {
matchBrackets: true
}).markText(
{line: 0, ch: 10},
{line: 0, ch: 22},
"highlight"
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment