Sha256: 9e03dc630e5051dc18a930eec5619bdfa4c4e0bbc25d5314d82ec3356e009568

Contents?: true

Size: 1.92 KB

Versions: 46

Compression:

Stored size: 1.92 KB

Contents

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>CodeMirror: Mode Runner Demo</title>
    <link rel="stylesheet" href="../lib/codemirror.css">
    <script src="../lib/codemirror.js"></script>
    <script src="../lib/util/runmode.js"></script>
    <script src="../mode/xml/xml.js"></script>
    <link rel="stylesheet" href="../doc/docs.css">
  </head>
  <body>
    <h1>CodeMirror: Mode Runner Demo</h1>

    <textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
<foobar>
  <blah>Enter your xml here and press the button below to display
    it as highlighted by the CodeMirror XML mode</blah>
  <tag2 foo="2" bar="&amp;quot;bar&amp;quot;"/>
</foobar></textarea><br>
    <button onclick="doHighlight();">Highlight!</button>
    <pre id="output" class="cm-s-default"></pre>

    <script>
function doHighlight() {
  CodeMirror.runMode(document.getElementById("code").value, "application/xml",
                     document.getElementById("output"));
}
</script>

    <p>Running a CodeMirror mode outside of the editor.
    The <code>CodeMirror.runMode</code> function, defined
    in <code><a href="../lib/util/runmode.js">lib/runmode.js</a></code> takes the following arguments:</p>

    <dl>
      <dt><code>text (string)</code></dt>
      <dd>The document to run through the highlighter.</dd>
      <dt><code>mode (<a href="../doc/manual.html#option_mode">mode spec</a>)</code></dt>
      <dd>The mode to use (must be loaded as normal).</dd>
      <dt><code>output (function or DOM node)</code></dt>
      <dd>If this is a function, it will be called for each token with
      two arguments, the token's text and the token's style class (may
      be <code>null</code> for unstyled tokens). If it is a DOM node,
      the tokens will be converted to <code>span</code> elements as in
      an editor, and inserted into the node
      (through <code>innerHTML</code>).</dd>
    </dl>

  </body>
</html>

Version data entries

46 entries across 23 versions & 1 rubygems

Version Path
rearview-1.2.3-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.2.3-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.2.2.rc.2-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.2.2.rc.2-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.2.2.rc.1-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.2.2.rc.1-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.2.1-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.2.1-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.2.0-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.2.0-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.1.2-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.1.2-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.1.1-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.1.1-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.1.0-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.1.0-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.0.3.rc.4-jruby public/rearview/vendor/codemirror/demo/runmode.html
rearview-1.0.3.rc.4-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.0.3.rc.3-jruby public/rearview-src/vendor/codemirror/demo/runmode.html
rearview-1.0.3.rc.3-jruby public/rearview/vendor/codemirror/demo/runmode.html