10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CodeMirror 2

CodeMirror 2 is a rewrite of [CodeMirror
1](http://github.com/marijnh/CodeMirror). The docs live
[here](http://codemirror.net/doc/manual.html), and the project page is
[http://codemirror.net/](http://codemirror.net/).
CodeMirror is a JavaScript component that provides a code editor in
the browser. When a mode is available for the language you are coding
in, it will color your code, and optionally help with indentation.

The project page is http://codemirror.net
The manual is at http://codemirror.net/doc/manual.html
59 changes: 59 additions & 0 deletions demo/multiplex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!doctype html>
<html>
<head>
<title>CodeMirror: Multiplexing Parser Demo</title>
<link rel="stylesheet" href="../lib/codemirror.css">
<script src="../lib/codemirror.js"></script>
<script src="../lib/util/multiplex.js"></script>
<script src="../mode/xml/xml.js"></script>
<link rel="stylesheet" href="../doc/docs.css">

<style type="text/css">
.CodeMirror {border: 1px solid black;}
.cm-delimit {color: #fa4;}
</style>
</head>
<body>
<h1>CodeMirror: Multiplexing Parser Demo</h1>

<form><textarea id="code" name="code">
<html>
<body>
<h1><< this is not <html >></h1>
<<
multiline
not html
at all : &amp;amp; <link/>
>>
<p>this is html again</p>
</body>
</html>
</textarea></form>

<script>
CodeMirror.defineMode("demo", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "text/html"),
{open: "<<", close: ">>",
mode: CodeMirror.getMode(config, "text/plain"),
delimStyle: "delimit"}
// .. more multiplexed styles can follow here
);
});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "demo",
lineNumbers: true,
lineWrapping: true
});
</script>

<p>Demonstration of a multiplexing mode, which, at certain
boundary strings, switches to one or more inner modes. The out
(HTML) mode does not get fed the content of the <code>&lt;&lt;
>></code> blocks. See
the <a href="../doc/manual.html#util_multiplex">manual</a> and
the <a href="../lib/util/multiplex.js">source</a> for more
information.</p>

</body>
</html>
2 changes: 1 addition & 1 deletion demo/mustache.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>{{title}}</h1>
return null;
}
};
return CodeMirror.overlayParser(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"});
</script>
Expand Down
2 changes: 0 additions & 2 deletions demo/resize.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
height: auto;
overflow-y: hidden;
overflow-x: auto;
width: 100%;
}
</style>
</head>
Expand All @@ -27,7 +26,6 @@ <h1>CodeMirror: Autoresize demo</h1>
height: auto;
overflow-y: hidden;
overflow-x: auto;
width: 100%
}</textarea></form>

<p>By setting a few CSS properties, CodeMirror can be made to
Expand Down
4 changes: 3 additions & 1 deletion demo/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
<link rel="stylesheet" href="../theme/xq-dark.css">
<link rel="stylesheet" href="../theme/ambiance.css">
<link rel="stylesheet" href="../theme/blackboard.css">
<link rel="stylesheet" href="../theme/vibrant-ink.css">
<script src="../mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="../doc/docs.css">

<style type="text/css">
.CodeMirror {border: 1px solid black;}
.CodeMirror {border: 1px solid black; font-size:13px}
</style>
</head>
<body>
Expand Down Expand Up @@ -53,6 +54,7 @@ <h1>CodeMirror: Theme demo</h1>
<option>neat</option>
<option>night</option>
<option>rubyblue</option>
<option>vibrant-ink</option>
<option>xq-dark</option>
</select>
</p>
Expand Down
2 changes: 2 additions & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
<option value="http://codemirror.net/">HEAD</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.3;f=">2.3</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.25;f=">2.25</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.24;f=">2.24</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.23;f=">2.23</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.22;f=">2.22</option>
Expand Down
34 changes: 31 additions & 3 deletions doc/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ <h2 id="styling">Customized Styling</h2>
by <code>pre</code> elements. By default no text styling (such as
bold) that might change line height is applied. If you do want
such effects, you'll have to give <code>CodeMirror pre</code> a
fixed height. Also, you must still take care that character width
is constant.</p>
fixed height.</p>

<p>If your page's style sheets do funky things to
all <code>div</code> or <code>pre</code> elements (you probably
Expand Down Expand Up @@ -487,6 +486,10 @@ <h2 id="api">Programming API</h2>
<dd>Scroll the editor to a given (pixel) position. Both
arguments may be left as <code>null</code>
or <code>undefined</code> to have no effect.</dd>
<dt id="getScrollInfo"><code>getScrollInfo()</code></dt>
<dd>Get an <code>{x, y, width, height}</code> object that
represents the current scroll position and scrollable area size
of the editor.</dd>

<dt id="setOption"><code>setOption(option, value)</code></dt>
<dd>Change the configuration of the editor. <code>option</code>
Expand Down Expand Up @@ -535,7 +538,7 @@ <h2 id="api">Programming API</h2>

<dt id="getTokenAt"><code>getTokenAt(pos) → object</code></dt>
<dd>Retrieves information about the token the current mode found
at the given position (a <code>{line, ch}</code> object). The
before the given position (a <code>{line, ch}</code> object). The
returned object has the following properties:
<dl>
<dt><code>start</code></dt><dd>The character (on the given line) at which the token starts.</dd>
Expand Down Expand Up @@ -821,6 +824,31 @@ <h2 id="addons">Add-ons</h2>
actually opening an editor instance.
See <a href="../demo/runmode.html">the demo</a> for an
example.</dd>
<dt id="util_overlay"><a href="../lib/util/overlay.js"><code>overlay.js</code></a></dt>
<dd>Mode combinator that can be used to extend a mode with an
'overlay' — a secondary mode is run over the stream, along with
the base mode, and can color specific pieces of text without
interfering with the base mode.
Defines <code>CodeMirror.overlayMode</code>, which is used to
create such a mode. See <a href="../demo/mustache.html">this
demo</a> for a detailed example.</dd>
<dt id="util_multiplex"><a href="../lib/util/multiplex.js"><code>multiplex.js</code></a></dt>
<dd>Mode combinator that can be used to easily 'multiplex'
between several modes.
Defines <code>CodeMirror.multiplexingMode</code> which, when
given as first argument a mode object, and as other arguments
any number of <code>{open, close, mode [, delimStyle]}</code>
objects, will return a mode object that starts parsing using the
mode passed as first argument, but will switch to another mode
as soon as it encounters a string that occurs in one of
the <code>open</code> fields of the passed objects. When in a
sub-mode, it will go back to the top mode again when
the <code>close</code> string is encountered.
When <code>delimStyle</code> is specified, it will be the token
style returned for the delimiter tokens. The outer mode will not
see the content between the delimiters.
See <a href="../demo/multiplex.html">this demo</a> for an
example.</dd>
<dt id="util_simple-hint"><a href="../lib/util/simple-hint.js"><code>simple-hint.js</code></a></dt>
<dd>Provides a framework for showing autocompletion hints.
Defines <code>CodeMirror.simpleHint</code>, which takes a
Expand Down
16 changes: 16 additions & 0 deletions doc/oldrelease.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi

</pre>

<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.15.zip">Version 2.15</a>:</p>
<p class="rel-note">Fix bug that snuck into 2.14: Clicking the
character that currently has the cursor didn't re-focus the
editor.</p>

<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.14.zip">Version 2.14</a>:</p>
<ul class="rel-note">
<li>Add <a href="../mode/clojure/index.html">Clojure</a>, <a href="../mode/pascal/index.html">Pascal</a>, <a href="../mode/ntriples/index.html">NTriples</a>, <a href="../mode/jinja2/index.html">Jinja2</a>, and <a href="../mode/markdown/index.html">Markdown</a> modes.</li>
<li>Add <a href="../theme/cobalt.css">Cobalt</a> and <a href="../theme/eclipse.css">Eclipse</a> themes.</li>
<li>Add a <a href="manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
<li>Fix bug with <code>setValue</code> breaking cursor movement.</li>
<li>Make gutter updates much more efficient.</li>
<li>Allow dragging of text out of the editor (on modern browsers).</li>
</ul>


<p class="rel">23-08-2011: <a href="http://codemirror.net/codemirror-2.13.zip">Version 2.13</a>:</p>
<ul class="rel-note">
<li>Add <a href="../mode/ruby/index.html">Ruby</a>, <a href="../mode/r/index.html">R</a>, <a href="../mode/coffeescript/index.html">CoffeeScript</a>, and <a href="../mode/velocity/index.html">Velocity</a> modes.</li>
Expand Down
40 changes: 23 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<h2 style="margin-top: 0">Supported modes:</h2>

<ul>
<li><a href="mode/clike/index.html">C, C++, C#, Java, and similar</a></li>
<li><a href="mode/clike/index.html">C, C++, C#</a></li>
<li><a href="mode/clojure/index.html">Clojure</a></li>
<li><a href="mode/coffeescript/index.html">CoffeeScript</a></li>
<li><a href="mode/css/index.html">CSS</a></li>
Expand All @@ -44,6 +44,7 @@ <h2 style="margin-top: 0">Supported modes:</h2>
<li><a href="mode/haskell/index.html">Haskell</a></li>
<li><a href="mode/htmlembedded/index.html">HTML embedded scripts</a></li>
<li><a href="mode/htmlmixed/index.html">HTML mixed-mode</a></li>
<li><a href="mode/clike/index.html">Java</a></li>
<li><a href="mode/javascript/index.html">JavaScript</a></li>
<li><a href="mode/jinja2/index.html">Jinja2</a></li>
<li><a href="mode/less/index.html">LESS</a></li>
Expand All @@ -63,6 +64,7 @@ <h2 style="margin-top: 0">Supported modes:</h2>
<li><a href="mode/rst/index.html">reStructuredText</a></li>
<li><a href="mode/ruby/index.html">Ruby</a></li>
<li><a href="mode/rust/index.html">Rust</a></li>
<li><a href="mode/clike/scala.html">Scala</a></li>
<li><a href="mode/scheme/index.html">Scheme</a></li>
<li><a href="mode/shell/index.html">Shell</a></li>
<li><a href="mode/smalltalk/index.html">Smalltalk</a></li>
Expand Down Expand Up @@ -239,7 +241,26 @@ <h2>Support CodeMirror</h2>
IBAN: <i>NL26 RABO 0147 8507 70</i>
</p>

<h2>Releases:</h2>
<h2>Reading material</h2>

<ul>
<li><a href="doc/manual.html">User manual</a></li>
<li><a href="http://github.com/marijnh/CodeMirror2">Browse the code</a></li>
</ul>

<h2>Releases</h2>

<p class="rel">22-06-2012: <a href="http://codemirror.net/codemirror-2.3.zip">Version 2.3</a>:</p>

<ul class="rel-note">
<li><strong>New scrollbar implementation</strong>. Should flicker less. Changes DOM structure of the editor.</li>
<li>New theme: <a href="demo/theme.html?vibrant-ink">vibrant-ink</a>.</li>
<li>Many extensions to the VIM keymap (including text objects).</li>
<li>Add <a href="demo/multiplex.html">mode-multiplexing</a> utility script.</li>
<li>Fix bug where right-click paste works in read-only mode.</li>
<li>Add a <a href="doc/manual.html#getScrollInfo"><code>getScrollInfo</code></a> method.</li>
<li>Lots of other <a href="https://github.com/marijnh/CodeMirror2/compare/v2.25...v2.3">fixes</a>.</li>
</ul>

<p class="rel">23-05-2012: <a href="http://codemirror.net/codemirror-2.25.zip">Version 2.25</a>:</p>

Expand Down Expand Up @@ -380,21 +401,6 @@ <h2>Releases:</h2>
<li>Fix editing code with tabs in Internet Explorer.</li>
</ul>

<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.15.zip">Version 2.15</a>:</p>
<p class="rel-note">Fix bug that snuck into 2.14: Clicking the
character that currently has the cursor didn't re-focus the
editor.</p>

<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.14.zip">Version 2.14</a>:</p>
<ul class="rel-note">
<li>Add <a href="mode/clojure/index.html">Clojure</a>, <a href="mode/pascal/index.html">Pascal</a>, <a href="mode/ntriples/index.html">NTriples</a>, <a href="mode/jinja2/index.html">Jinja2</a>, and <a href="mode/markdown/index.html">Markdown</a> modes.</li>
<li>Add <a href="theme/cobalt.css">Cobalt</a> and <a href="theme/eclipse.css">Eclipse</a> themes.</li>
<li>Add a <a href="doc/manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
<li>Fix bug with <code>setValue</code> breaking cursor movement.</li>
<li>Make gutter updates much more efficient.</li>
<li>Allow dragging of text out of the editor (on modern browsers).</li>
</ul>

<p><a href="doc/oldrelease.html">Older releases...</a></p>

</div></div>
Expand Down
Loading