Skip to content

Commit

Permalink
Trying CodeMirror --
Browse files Browse the repository at this point in the history
Initially chose Ace for "performance" but the text so far is barely 1MB,
also Ran into issues with Indic text:
ajaxorg/ace#3137 (comment)

So trying CodeMirror, which certainly has the features I
want (https://codemirror.net/demo/bidi.html,
https://codemirror.net/demo/variableheight.html) and doesn't have
these bugs.
  • Loading branch information
shreevatsa committed Jul 14, 2017
1 parent 4bb406e commit 2cf0d32
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions codemirror.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Codemirror test</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.27.4/codemirror.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.27.4/codemirror.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.27.4/mode/markdown/markdown.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.27.4/mode/xml/xml.min.js"></script>
<style type="text/css">
.CodeMirror {border: 1px solid silver; border-width: 1px 2px; }
.cm-header { font-family: arial; }
.cm-header-1 { font-size: 150%; }
.cm-header-2 { font-size: 130%; }
.cm-header-3 { font-size: 120%; }
.cm-header-4 { font-size: 110%; }
.cm-header-5 { font-size: 100%; }
.cm-header-6 { font-size: 90%; }
/* .cm-strong { font-size: 140%; } */

#container {
display: flex;
flex-direction: column;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.CodeMirror {
flex: 1 30em;
display: inline-block;
}
</style>
</head>

<body>
<div id="container">
<p>Type some text here.</p>
<textarea id="code" name="code"># A First Level Header

**Bold** text in a normal-size paragraph.

And a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long, wrapped line with a piece of **big** text inside of it.

## A Second Level Header

Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.

The quick brown fox jumped over the lazy
dog's back.

### Header 3

> This is a blockquote.
>
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote
</textarea>
<p>See above</p>
</div>
<script id="script">
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
lineWrapping: true,
mode: "markdown"
});
</script>
</body>
</html>

0 comments on commit 2cf0d32

Please sign in to comment.