├── demo ├── codemirror │ ├── .travis.yml │ ├── .gitignore │ ├── doc │ │ ├── baboon.png │ │ └── reporting.html │ ├── .gitattributes │ ├── theme │ │ ├── ambiance-mobile.css │ │ ├── neat.css │ │ ├── elegant.css │ │ ├── cobalt.css │ │ ├── eclipse.css │ │ ├── night.css │ │ ├── monokai.css │ │ ├── erlang-dark.css │ │ ├── blackboard.css │ │ ├── rubyblue.css │ │ ├── vibrant-ink.css │ │ ├── 3024-day.css │ │ ├── twilight.css │ │ ├── 3024-night.css │ │ ├── base16-dark.css │ │ ├── base16-light.css │ │ ├── midnight.css │ │ ├── tomorrow-night-eighties.css │ │ ├── lesser-dark.css │ │ ├── xq-light.css │ │ └── xq-dark.css │ ├── test │ │ ├── mode_test.css │ │ ├── run.js │ │ ├── phantom_driver.js │ │ └── comment_test.js │ ├── mode │ │ ├── rpm │ │ │ ├── spec │ │ │ │ └── spec.css │ │ │ └── changes │ │ │ │ ├── changes.js │ │ │ │ └── index.html │ │ ├── tiddlywiki │ │ │ └── tiddlywiki.css │ │ ├── javascript │ │ │ ├── test.js │ │ │ └── typescript.html │ │ ├── tiki │ │ │ ├── tiki.css │ │ │ └── index.html │ │ ├── diff │ │ │ └── diff.js │ │ ├── pascal │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── sieve │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── python │ │ │ └── LICENSE.txt │ │ ├── perl │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── ntriples │ │ │ └── index.html │ │ ├── rst │ │ │ └── LICENSE.txt │ │ ├── xquery │ │ │ └── LICENSE │ │ ├── http │ │ │ └── index.html │ │ ├── vb │ │ │ └── LICENSE.txt │ │ ├── ecl │ │ │ └── index.html │ │ ├── z80 │ │ │ └── index.html │ │ ├── coffeescript │ │ │ └── LICENSE │ │ ├── jinja2 │ │ │ ├── index.html │ │ │ └── jinja2.js │ │ ├── rust │ │ │ └── index.html │ │ ├── pig │ │ │ └── index.html │ │ ├── livescript │ │ │ └── LICENSE │ │ ├── turtle │ │ │ └── index.html │ │ ├── vbscript │ │ │ └── index.html │ │ ├── properties │ │ │ ├── index.html │ │ │ └── properties.js │ │ ├── sparql │ │ │ └── index.html │ │ ├── sass │ │ │ └── index.html │ │ ├── css │ │ │ └── index.html │ │ ├── shell │ │ │ └── index.html │ │ ├── r │ │ │ ├── LICENSE │ │ │ └── index.html │ │ ├── ruby │ │ │ └── LICENSE │ │ ├── gas │ │ │ └── index.html │ │ ├── smalltalk │ │ │ └── index.html │ │ ├── xml │ │ │ └── index.html │ │ ├── php │ │ │ └── index.html │ │ ├── htmlembedded │ │ │ └── index.html │ │ ├── apl │ │ │ └── index.html │ │ ├── haml │ │ │ └── index.html │ │ ├── yaml │ │ │ └── index.html │ │ ├── lua │ │ │ └── index.html │ │ ├── erlang │ │ │ └── index.html │ │ ├── haskell │ │ │ └── index.html │ │ ├── groovy │ │ │ └── index.html │ │ ├── jade │ │ │ └── index.html │ │ ├── go │ │ │ └── index.html │ │ ├── haxe │ │ │ └── index.html │ │ ├── gfm │ │ │ └── index.html │ │ ├── clojure │ │ │ └── index.html │ │ ├── scheme │ │ │ └── index.html │ │ └── sql │ │ │ └── index.html │ ├── bower.json │ ├── bin │ │ ├── lint │ │ └── source-highlight │ ├── addon │ │ ├── lint │ │ │ ├── json-lint.js │ │ │ └── coffeescript-lint.js │ │ ├── edit │ │ │ ├── trailingspace.js │ │ │ ├── continuelist.js │ │ │ ├── matchtags.js │ │ │ └── continuecomment.js │ │ ├── dialog │ │ │ └── dialog.css │ │ ├── fold │ │ │ ├── indent-fold.js │ │ │ └── foldcode.js │ │ ├── mode │ │ │ ├── multiplex_test.js │ │ │ ├── loadmode.js │ │ │ └── overlay.js │ │ ├── hint │ │ │ ├── show-hint.css │ │ │ └── anyword-hint.js │ │ ├── runmode │ │ │ ├── colorize.js │ │ │ └── runmode.js │ │ ├── tern │ │ │ ├── worker.js │ │ │ └── tern.css │ │ ├── selection │ │ │ └── active-line.js │ │ └── display │ │ │ └── placeholder.js │ ├── README.md │ ├── package.json │ ├── LICENSE │ ├── demo │ │ ├── matchtags.html │ │ ├── markselection.html │ │ ├── placeholder.html │ │ ├── resize.html │ │ ├── loadmode.html │ │ ├── trailingspace.html │ │ ├── closetag.html │ │ ├── matchhighlighter.html │ │ ├── changemode.html │ │ ├── html5complete.html │ │ ├── variableheight.html │ │ ├── visibletabs.html │ │ ├── marker.html │ │ ├── mustache.html │ │ ├── multiplex.html │ │ ├── runmode.html │ │ ├── merge.html │ │ ├── vim.html │ │ ├── indentwrap.html │ │ ├── preview.html │ │ ├── emacs.html │ │ ├── closebrackets.html │ │ └── bidi.html │ └── keymap │ │ └── extra.js └── index.html ├── demo.gif ├── README.md └── LICENSE /demo/codemirror/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chinchang/code-blast-codemirror/HEAD/demo.gif -------------------------------------------------------------------------------- /demo/codemirror/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /npm-debug.log 3 | test.html 4 | .tern-* 5 | *~ 6 | *.swp 7 | -------------------------------------------------------------------------------- /demo/codemirror/doc/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chinchang/code-blast-codemirror/HEAD/demo/codemirror/doc/baboon.png -------------------------------------------------------------------------------- /demo/codemirror/.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt text 2 | *.js text 3 | *.html text 4 | *.md text 5 | *.json text 6 | *.yml text 7 | *.css text 8 | *.svg text 9 | -------------------------------------------------------------------------------- /demo/codemirror/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | box-shadow: none; 5 | } 6 | -------------------------------------------------------------------------------- /demo/codemirror/test/mode_test.css: -------------------------------------------------------------------------------- 1 | .mt-output .mt-token { 2 | border: 1px solid #ddd; 3 | white-space: pre; 4 | font-family: "Consolas", monospace; 5 | text-align: center; 6 | } 7 | 8 | .mt-output .mt-style { 9 | font-size: x-small; 10 | } 11 | -------------------------------------------------------------------------------- /demo/codemirror/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /demo/codemirror/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /demo/codemirror/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeMirror", 3 | "version": "3.15.0", 4 | "main": ["lib/codemirror.js", "lib/codemirror.css"], 5 | "ignore": [ 6 | "**/.*", 7 | "node_modules", 8 | "components", 9 | "bin", 10 | "demo", 11 | "doc", 12 | "test", 13 | "index.html", 14 | "package.json" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /demo/codemirror/bin/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var lint = require("../test/lint/lint"); 4 | 5 | if (process.argv.length > 2) { 6 | lint.checkDir(process.argv[2]); 7 | } else { 8 | process.chdir(__dirname.slice(0, __dirname.lastIndexOf("/"))); 9 | lint.checkDir("lib"); 10 | lint.checkDir("mode"); 11 | lint.checkDir("addon"); 12 | lint.checkDir("keymap"); 13 | } 14 | 15 | process.exit(lint.success() ? 0 : 1); 16 | -------------------------------------------------------------------------------- /demo/codemirror/mode/javascript/test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var mode = CodeMirror.getMode({indentUnit: 2}, "javascript"); 3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 4 | 5 | MT("locals", 6 | "[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] = [number 10]; [keyword return] [variable-2 a] + [variable-2 c] + [variable d]; }"); 7 | 8 | MT("comma-and-binop", 9 | "[keyword function](){ [keyword var] [def x] = [number 1] + [number 2], [def y]; }"); 10 | })(); 11 | -------------------------------------------------------------------------------- /demo/codemirror/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFF; 3 | background-color: #900; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /demo/codemirror/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | -------------------------------------------------------------------------------- /demo/codemirror/addon/lint/json-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint 2 | 3 | CodeMirror.registerHelper("lint", "json", function(text) { 4 | var found = []; 5 | jsonlint.parseError = function(str, hash) { 6 | var loc = hash.loc; 7 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), 8 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), 9 | message: str}); 10 | }; 11 | try { jsonlint.parse(text); } 12 | catch(e) {} 13 | return found; 14 | }); 15 | CodeMirror.jsonValidator = CodeMirror.lint.json; // deprecated 16 | -------------------------------------------------------------------------------- /demo/codemirror/addon/edit/trailingspace.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { 2 | if (prev == CodeMirror.Init) prev = false; 3 | if (prev && !val) 4 | cm.removeOverlay("trailingspace"); 5 | else if (!prev && val) 6 | cm.addOverlay({ 7 | token: function(stream) { 8 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} 9 | if (i > stream.pos) { stream.pos = i; return null; } 10 | stream.pos = l; 11 | return "trailingspace"; 12 | }, 13 | name: "trailingspace" 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /demo/codemirror/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | .cm-s-elegant span.cm-link {color: #762;} 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Code-blast plugin for Codemirror 2 | 3 | This is a quick Codemirror port of [lovely experiement by Joel Besada](https://twitter.com/JoelBesada/status/670343885655293952). 4 | 5 | Simply put `code-blast.js` in your project and set the `blastCode` option to true when initializing codemirror. This library comes with inbuilt 2 types of effect. 6 | 7 | [Live Demo](https://rawgit.com/chinchang/code-blast-codemirror/master/demo/index.html) 8 | 9 | ![Demo](/demo.gif) 10 | 11 | ```js 12 | var cm = CodeMirror(document.body, { 13 | blastCode: { effect: 1}, // `effect` can be 1 or 2 14 | } 15 | ``` 16 | 17 | ### Coming up 18 | 19 | - Configurable options 20 | -------------------------------------------------------------------------------- /demo/codemirror/addon/dialog/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: absolute; 3 | left: 0; right: 0; 4 | background: white; 5 | z-index: 15; 6 | padding: .1em .8em; 7 | overflow: hidden; 8 | color: #333; 9 | } 10 | 11 | .CodeMirror-dialog-top { 12 | border-bottom: 1px solid #eee; 13 | top: 0; 14 | } 15 | 16 | .CodeMirror-dialog-bottom { 17 | border-top: 1px solid #eee; 18 | bottom: 0; 19 | } 20 | 21 | .CodeMirror-dialog input { 22 | border: none; 23 | outline: none; 24 | background: transparent; 25 | width: 20em; 26 | color: inherit; 27 | font-family: monospace; 28 | } 29 | 30 | .CodeMirror-dialog button { 31 | font-size: 70%; 32 | } 33 | -------------------------------------------------------------------------------- /demo/codemirror/README.md: -------------------------------------------------------------------------------- 1 | # CodeMirror 2 | [![Build Status](https://secure.travis-ci.org/marijnh/CodeMirror.png?branch=master)](http://travis-ci.org/marijnh/CodeMirror) 3 | [![NPM version](https://badge.fury.io/js/codemirror.png)](http://badge.fury.io/js/codemirror) 4 | 5 | CodeMirror is a JavaScript component that provides a code editor in 6 | the browser. When a mode is available for the language you are coding 7 | in, it will color your code, and optionally help with indentation. 8 | 9 | The project page is http://codemirror.net 10 | The manual is at http://codemirror.net/doc/manual.html 11 | The contributing guidelines are in [CONTRIBUTING.md](https://github.com/marijnh/CodeMirror/blob/master/CONTRIBUTING.md) 12 | -------------------------------------------------------------------------------- /demo/codemirror/addon/fold/indent-fold.js: -------------------------------------------------------------------------------- 1 | CodeMirror.registerHelper("fold", "indent", function(cm, start) { 2 | var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line); 3 | var myIndent = CodeMirror.countColumn(firstLine, null, tabSize); 4 | for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) { 5 | var curLine = cm.getLine(i); 6 | if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent && 7 | CodeMirror.countColumn(cm.getLine(i-1), null, tabSize) > myIndent) 8 | return {from: CodeMirror.Pos(start.line, firstLine.length), 9 | to: CodeMirror.Pos(i, curLine.length)}; 10 | } 11 | }); 12 | CodeMirror.indentRangeFinder = CodeMirror.fold.indent; // deprecated 13 | -------------------------------------------------------------------------------- /demo/codemirror/mode/rpm/changes/changes.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("changes", function() { 2 | var headerSeperator = /^-+$/; 3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 5 | 6 | return { 7 | token: function(stream) { 8 | if (stream.sol()) { 9 | if (stream.match(headerSeperator)) { return 'tag'; } 10 | if (stream.match(headerLine)) { return 'tag'; } 11 | } 12 | if (stream.match(simpleEmail)) { return 'string'; } 13 | stream.next(); 14 | return null; 15 | } 16 | }; 17 | }); 18 | 19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes"); 20 | -------------------------------------------------------------------------------- /demo/codemirror/addon/edit/continuelist.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/, 5 | unorderedBullets = '*+-'; 6 | 7 | CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { 8 | var pos = cm.getCursor(), 9 | inList = cm.getStateAfter(pos.line).list, 10 | match; 11 | 12 | if (!inList || !(match = cm.getLine(pos.line).match(listRE))) { 13 | cm.execCommand('newlineAndIndent'); 14 | return; 15 | } 16 | 17 | var indent = match[1], after = match[4]; 18 | var bullet = unorderedBullets.indexOf(match[2]) >= 0 19 | ? match[2] 20 | : (parseInt(match[3], 10) + 1) + '.'; 21 | 22 | cm.replaceSelection('\n' + indent + bullet + after, 'end'); 23 | }; 24 | 25 | }()); 26 | -------------------------------------------------------------------------------- /demo/codemirror/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | 3 | var TOKEN_NAMES = { 4 | '+': 'positive', 5 | '-': 'negative', 6 | '@': 'meta' 7 | }; 8 | 9 | return { 10 | token: function(stream) { 11 | var tw_pos = stream.string.search(/[\t ]+?$/); 12 | 13 | if (!stream.sol() || tw_pos === 0) { 14 | stream.skipToEnd(); 15 | return ("error " + ( 16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 17 | } 18 | 19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 20 | 21 | if (tw_pos === -1) { 22 | stream.skipToEnd(); 23 | } else { 24 | stream.pos = tw_pos; 25 | } 26 | 27 | return token_name; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-diff", "diff"); 33 | -------------------------------------------------------------------------------- /demo/codemirror/addon/mode/multiplex_test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | CodeMirror.defineMode("markdown_with_stex", function(){ 3 | var inner = CodeMirror.getMode({}, "stex"); 4 | var outer = CodeMirror.getMode({}, "markdown"); 5 | 6 | var innerOptions = { 7 | open: '$', 8 | close: '$', 9 | mode: inner, 10 | delimStyle: 'delim', 11 | innerStyle: 'inner' 12 | }; 13 | 14 | return CodeMirror.multiplexingMode(outer, innerOptions); 15 | }); 16 | 17 | var mode = CodeMirror.getMode({}, "markdown_with_stex"); 18 | 19 | function MT(name) { 20 | test.mode( 21 | name, 22 | mode, 23 | Array.prototype.slice.call(arguments, 1), 24 | 'multiplexing'); 25 | } 26 | 27 | MT( 28 | "stexInsideMarkdown", 29 | "[strong **Equation:**] [delim $][inner&tag \\pi][delim $]"); 30 | })(); 31 | -------------------------------------------------------------------------------- /demo/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | max-width: 19em; 29 | overflow: hidden; 30 | white-space: pre; 31 | color: black; 32 | cursor: pointer; 33 | } 34 | 35 | .CodeMirror-hint-active { 36 | background: #08f; 37 | color: white; 38 | } 39 | -------------------------------------------------------------------------------- /demo/codemirror/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codemirror", 3 | "version":"3.15.0", 4 | "main": "lib/codemirror.js", 5 | "description": "In-browser code editing made bearable", 6 | "licenses": [{"type": "MIT", 7 | "url": "http://codemirror.net/LICENSE"}], 8 | "directories": {"lib": "./lib"}, 9 | "scripts": {"test": "node ./test/run.js"}, 10 | "devDependencies": {"node-static": "0.6.0"}, 11 | "bugs": "http://github.com/marijnh/CodeMirror/issues", 12 | "keywords": ["JavaScript", "CodeMirror", "Editor"], 13 | "homepage": "http://codemirror.net", 14 | "maintainers":[{"name": "Marijn Haverbeke", 15 | "email": "marijnh@gmail.com", 16 | "web": "http://marijnhaverbeke.nl"}], 17 | "repository": {"type": "git", 18 | "url": "http://marijnhaverbeke.nl/git/codemirror"} 19 | } 20 | -------------------------------------------------------------------------------- /demo/codemirror/addon/runmode/colorize.js: -------------------------------------------------------------------------------- 1 | CodeMirror.colorize = (function() { 2 | 3 | var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; 4 | 5 | function textContent(node, out) { 6 | if (node.nodeType == 3) return out.push(node.nodeValue); 7 | for (var ch = node.firstChild; ch; ch = ch.nextSibling) { 8 | textContent(ch, out); 9 | if (isBlock.test(node.nodeType)) out.push("\n"); 10 | } 11 | } 12 | 13 | return function(collection, defaultMode) { 14 | if (!collection) collection = document.body.getElementsByTagName("pre"); 15 | 16 | for (var i = 0; i < collection.length; ++i) { 17 | var node = collection[i]; 18 | var mode = node.getAttribute("data-lang") || defaultMode; 19 | if (!mode) continue; 20 | 21 | var text = []; 22 | textContent(node, text); 23 | node.innerHTML = ""; 24 | CodeMirror.runMode(text.join(""), mode, node); 25 | 26 | node.className += " cm-s-default"; 27 | } 28 | }; 29 | })(); 30 | -------------------------------------------------------------------------------- /demo/codemirror/addon/lint/coffeescript-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js 2 | 3 | CodeMirror.registerHelper("lint", "coffeescript", function(text) { 4 | var found = []; 5 | var parseError = function(err) { 6 | var loc = err.lineNumber; 7 | found.push({from: CodeMirror.Pos(loc-1, 0), 8 | to: CodeMirror.Pos(loc, 0), 9 | severity: err.level, 10 | message: err.message}); 11 | }; 12 | try { 13 | var res = coffeelint.lint(text); 14 | for(var i = 0; i < res.length; i++) { 15 | parseError(res[i]); 16 | } 17 | } catch(e) { 18 | found.push({from: CodeMirror.Pos(e.location.first_line, 0), 19 | to: CodeMirror.Pos(e.location.last_line, e.location.last_column), 20 | severity: 'error', 21 | message: e.message}); 22 | } 23 | return found; 24 | }); 25 | CodeMirror.coffeeValidator = CodeMirror.lint.coffeescript; // deprecated 26 | -------------------------------------------------------------------------------- /demo/codemirror/test/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var lint = require("./lint/lint"); 4 | 5 | lint.checkDir("mode"); 6 | lint.checkDir("lib"); 7 | lint.checkDir("addon"); 8 | lint.checkDir("keymap"); 9 | 10 | var ok = lint.success(); 11 | 12 | var files = new (require('node-static').Server)('.'); 13 | 14 | var server = require('http').createServer(function (req, res) { 15 | req.addListener('end', function () { 16 | files.serve(req, res); 17 | }); 18 | }).addListener('error', function (err) { 19 | throw err; 20 | }).listen(3000, function () { 21 | var child_process = require('child_process'); 22 | child_process.exec("which phantomjs", function (err) { 23 | if (err) { 24 | console.error("PhantomJS is not installed. Download from http://phantomjs.org"); 25 | process.exit(1); 26 | } 27 | var cmd = 'phantomjs test/phantom_driver.js'; 28 | child_process.exec(cmd, function (err, stdout) { 29 | server.close(); 30 | console.log(stdout); 31 | process.exit(err || !ok ? 1 : 0); 32 | }); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /demo/codemirror/test/phantom_driver.js: -------------------------------------------------------------------------------- 1 | var page = require('webpage').create(); 2 | 3 | page.open("http://localhost:3000/test/index.html", function (status) { 4 | if (status != "success") { 5 | console.log("page couldn't be loaded successfully"); 6 | phantom.exit(1); 7 | } 8 | waitFor(function () { 9 | return page.evaluate(function () { 10 | var output = document.getElementById('status'); 11 | if (!output) { return false; } 12 | return (/^(\d+ failures?|all passed)/i).test(output.innerText); 13 | }); 14 | }, function () { 15 | var failed = page.evaluate(function () { return window.failed; }); 16 | var output = page.evaluate(function () { 17 | return document.getElementById('output').innerText + "\n" + 18 | document.getElementById('status').innerText; 19 | }); 20 | console.log(output); 21 | phantom.exit(failed > 0 ? 1 : 0); 22 | }); 23 | }); 24 | 25 | function waitFor (test, cb) { 26 | if (test()) { 27 | cb(); 28 | } else { 29 | setTimeout(function () { waitFor(test, cb); }, 250); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /demo/codemirror/mode/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 souceLair 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /demo/codemirror/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | .cm-s-cobalt span.cm-link { color: #845dc4; } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kushagra Gour 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/codemirror/mode/sieve/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Thomas Schmid 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /demo/codemirror/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | .cm-s-eclipse span.cm-link {color: #219;} 21 | 22 | .cm-s-eclipse .CodeMirror-matchingbracket { 23 | outline:1px solid grey; 24 | color:black !important; 25 | } 26 | -------------------------------------------------------------------------------- /demo/codemirror/mode/python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Timothy Farrell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /demo/codemirror/mode/perl/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Sabaca under the MIT license. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /demo/codemirror/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: NTriples mode 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 |

CodeMirror: NTriples mode

18 |
19 | 26 |
27 | 28 | 31 |

MIME types defined: text/n-triples.

32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/codemirror/mode/rst/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013 Hasan Karahan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /demo/codemirror/mode/xquery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by MarkLogic Corporation 2 | Author: Mike Brevoort 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. -------------------------------------------------------------------------------- /demo/codemirror/mode/http/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTTP mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: HTTP mode

14 | 15 |
25 | 26 | 29 | 30 |

MIME types defined: message/http.

31 | 32 | 33 | -------------------------------------------------------------------------------- /demo/codemirror/mode/vb/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/codemirror/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | .cm-s-night span.cm-link { color: #845dc4; } 22 | -------------------------------------------------------------------------------- /demo/codemirror/addon/tern/worker.js: -------------------------------------------------------------------------------- 1 | var server; 2 | 3 | this.onmessage = function(e) { 4 | var data = e.data; 5 | switch (data.type) { 6 | case "init": return startServer(data.defs, data.plugins, data.scripts); 7 | case "add": return server.addFile(data.name, data.text); 8 | case "del": return server.delFile(data.name); 9 | case "req": return server.request(data.body, function(err, reqData) { 10 | postMessage({id: data.id, body: reqData, err: err && String(err)}); 11 | }); 12 | case "getFile": 13 | var c = pending[data.id]; 14 | delete pending[data.id]; 15 | return c(data.err, data.text); 16 | default: throw new Error("Unknown message type: " + data.type); 17 | } 18 | }; 19 | 20 | var nextId = 0, pending = {}; 21 | function getFile(file, c) { 22 | postMessage({type: "getFile", name: file, id: ++nextId}); 23 | pending[nextId] = c; 24 | } 25 | 26 | function startServer(defs, plugins, scripts) { 27 | if (scripts) importScripts.apply(null, scripts); 28 | 29 | server = new tern.Server({ 30 | getFile: getFile, 31 | async: true, 32 | defs: defs, 33 | plugins: plugins 34 | }); 35 | } 36 | 37 | var console = { 38 | log: function(v) { postMessage({type: "debug", message: v}); } 39 | }; 40 | -------------------------------------------------------------------------------- /demo/codemirror/mode/ecl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: ECL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: ECL mode

13 |
31 | 34 | 35 |

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

36 |

MIME types defined: text/x-ecl.

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/codemirror/mode/z80/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Z80 assembly mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Z80 assembly mode

14 | 15 |
30 | 31 | 36 | 37 |

MIME type defined: text/x-z80.

38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/codemirror/mode/coffeescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Jeff Pickhardt 4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /demo/codemirror/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Jinja2 mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Jinja2 mode

14 |
32 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demo/codemirror/theme/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 22 | .cm-s-monokai span.cm-tag {color: #f92672;} 23 | .cm-s-monokai span.cm-link {color: #ae81ff;} 24 | 25 | .cm-s-monokai .CodeMirror-matchingbracket { 26 | text-decoration: underline; 27 | color: white !important; 28 | } 29 | -------------------------------------------------------------------------------- /demo/codemirror/mode/rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Rust mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Rust mode

14 | 15 |
38 | 39 | 45 | 46 |

MIME types defined: text/x-rustsrc.

47 | 48 | 49 | -------------------------------------------------------------------------------- /demo/codemirror/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 by Marijn Haverbeke 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | Please note that some subdirectories of the CodeMirror distribution 22 | include their own LICENSE files, and are released under different 23 | licences. 24 | -------------------------------------------------------------------------------- /demo/codemirror/theme/erlang-dark.css: -------------------------------------------------------------------------------- 1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } 2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; } 8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } 9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } 10 | .cm-s-erlang-dark span.cm-builtin { color: #eaa; } 11 | .cm-s-erlang-dark span.cm-comment { color: #77f; } 12 | .cm-s-erlang-dark span.cm-def { color: #e7a; } 13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; } 14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; } 15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; } 16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; } 17 | .cm-s-erlang-dark span.cm-operator { color: #d11; } 18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; } 19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; } 20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; } 21 | .cm-s-erlang-dark span.cm-variable-2 { color: #e0e; } 22 | -------------------------------------------------------------------------------- /demo/codemirror/mode/pig/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Pig Latin mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Pig Latin mode

14 | 15 |
27 | 28 | 35 | 36 |

37 | Simple mode that handles Pig Latin language. 38 |

39 | 40 |

MIME type defined: text/x-pig 41 | (PIG code) 42 | 43 | -------------------------------------------------------------------------------- /demo/codemirror/demo/matchtags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Tag Matcher Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 |

CodeMirror: Tag Matcher Demo

20 | 21 |
22 | 23 | 33 | 34 |

Put the cursor on or inside a pair of tags to highlight them. 35 | Press Ctrl-J to jump to the tag that matches the one under the 36 | cursor.

37 | 38 | 39 | -------------------------------------------------------------------------------- /demo/codemirror/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Pascal mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Pascal mode

14 | 15 |
38 | 39 | 45 | 46 |

MIME types defined: text/x-pascal.

47 | 48 | 49 | -------------------------------------------------------------------------------- /demo/codemirror/mode/livescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013 Kenneth Bentley 4 | Modified from the CoffeeScript CodeMirror mode, Copyright (c) 2011 Jeff Pickhardt 5 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /demo/codemirror/mode/turtle/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Turtle mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Turtle mode

14 |
28 | 35 | 36 |

MIME types defined: text/turtle.

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/codemirror/theme/blackboard.css: -------------------------------------------------------------------------------- 1 | /* Port of TextMate's Blackboard theme */ 2 | 3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } 4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } 5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } 6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; } 7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 8 | 9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; } 10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; } 11 | .cm-s-blackboard .cm-number { color: #D8FA3C; } 12 | .cm-s-blackboard .cm-def { color: #8DA6CE; } 13 | .cm-s-blackboard .cm-variable { color: #FF6400; } 14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;} 15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; } 16 | .cm-s-blackboard .cm-string { color: #61CE3C; } 17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; } 18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; } 19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } 20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; } 21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; } 22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; } 23 | .cm-s-blackboard .cm-header { color: #FF6400; } 24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; } 25 | .cm-s-blackboard .cm-link { color: #8DA6CE; } 26 | -------------------------------------------------------------------------------- /demo/codemirror/theme/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue { font-family: Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ 2 | 3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } 4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } 5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } 6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; } 7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 13 | .cm-s-rubyblue span.cm-string { color: #F08047; } 14 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } 17 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 22 | -------------------------------------------------------------------------------- /demo/codemirror/mode/vbscript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: VBScript mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: VBScript mode

14 | 15 |
32 | 33 | 39 | 40 |

MIME types defined: text/vbscript.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demo/codemirror/demo/markselection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Match Highlighter Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |

CodeMirror: Mark Selection Demo

20 | 21 |
25 | 26 | 32 | 33 |

Simple addon to easily mark (and style) selected text.

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /demo/codemirror/demo/placeholder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Placeholder demo 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 |

CodeMirror: Placeholder demo

20 | 21 |
22 | 23 |

The placeholder 24 | plug-in adds an option placeholder that can be set to 25 | make text appear in the editor when it is empty and not focused. 26 | If the source textarea has a placeholder attribute, 27 | it will automatically be inherited.

28 | 29 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /demo/codemirror/mode/properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Properties files mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Properties files mode

14 |
33 | 36 | 37 |

MIME types defined: text/x-properties, 38 | text/x-ini.

39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /demo/codemirror/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Autoresize Demo 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | 23 |

CodeMirror: Autoresize demo

24 | 25 |
35 | 36 |

By setting a few CSS properties, and giving 37 | the viewportMargin 38 | a value of Infinity, CodeMirror can be made to 39 | automatically resize to fit its content.

40 | 41 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/codemirror/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | var WORD = /[\w$]+/, RANGE = 500; 5 | 6 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 7 | var word = options && options.word || WORD; 8 | var range = options && options.range || RANGE; 9 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 10 | var start = cur.ch, end = start; 11 | while (end < curLine.length && word.test(curLine.charAt(end))) ++end; 12 | while (start && word.test(curLine.charAt(start - 1))) --start; 13 | var curWord = start != end && curLine.slice(start, end); 14 | 15 | var list = [], seen = {}; 16 | function scan(dir) { 17 | var line = cur.line, end = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 18 | for (; line != end; line += dir) { 19 | var text = editor.getLine(line), m; 20 | var re = new RegExp(word.source, "g"); 21 | while (m = re.exec(text)) { 22 | if (line == cur.line && m[0] === curWord) continue; 23 | if ((!curWord || m[0].indexOf(curWord) == 0) && !seen.hasOwnProperty(m[0])) { 24 | seen[m[0]] = true; 25 | list.push(m[0]); 26 | } 27 | } 28 | } 29 | } 30 | scan(-1); 31 | scan(1); 32 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 33 | }); 34 | })(); 35 | -------------------------------------------------------------------------------- /demo/codemirror/mode/javascript/typescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: TypeScript mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: TypeScript mode

14 | 15 |
37 | 38 | 45 | 46 |

This is a specialization of the JavaScript mode.

47 | 48 | 49 | -------------------------------------------------------------------------------- /demo/codemirror/demo/loadmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Lazy Mode Loading Demo 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Lazy Mode Loading

17 | 18 |
23 |

24 | 25 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /demo/codemirror/demo/trailingspace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Trailing Whitespace Demo 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

CodeMirror: Trailing Whitespace Demo

22 | 23 |
26 | 27 | 33 | 34 |

Uses 35 | the trailingspace 36 | addon to highlight trailing whitespace.

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/codemirror/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: SPARQL mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: SPARQL mode

15 |
31 | 38 | 39 |

MIME types defined: application/x-sparql-query.

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/codemirror/mode/perl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Perl mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Perl mode

14 | 15 |
53 | 54 | 59 | 60 |

MIME types defined: text/x-perl.

61 | 62 | 63 | -------------------------------------------------------------------------------- /demo/codemirror/mode/sass/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Sass mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: Sass mode

15 |
45 | 51 | 52 |

MIME types defined: text/x-sass.

53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/codemirror/addon/selection/active-line.js: -------------------------------------------------------------------------------- 1 | // Because sometimes you need to style the cursor's line. 2 | // 3 | // Adds an option 'styleActiveLine' which, when enabled, gives the 4 | // active line's wrapping
the CSS class "CodeMirror-activeline", 5 | // and gives its background
the class "CodeMirror-activeline-background". 6 | 7 | (function() { 8 | "use strict"; 9 | var WRAP_CLASS = "CodeMirror-activeline"; 10 | var BACK_CLASS = "CodeMirror-activeline-background"; 11 | 12 | CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { 13 | var prev = old && old != CodeMirror.Init; 14 | if (val && !prev) { 15 | updateActiveLine(cm); 16 | cm.on("cursorActivity", updateActiveLine); 17 | } else if (!val && prev) { 18 | cm.off("cursorActivity", updateActiveLine); 19 | clearActiveLine(cm); 20 | delete cm.state.activeLine; 21 | } 22 | }); 23 | 24 | function clearActiveLine(cm) { 25 | if ("activeLine" in cm.state) { 26 | cm.removeLineClass(cm.state.activeLine, "wrap", WRAP_CLASS); 27 | cm.removeLineClass(cm.state.activeLine, "background", BACK_CLASS); 28 | } 29 | } 30 | 31 | function updateActiveLine(cm) { 32 | var line = cm.getLineHandleVisualStart(cm.getCursor().line); 33 | if (cm.state.activeLine == line) return; 34 | clearActiveLine(cm); 35 | cm.addLineClass(line, "wrap", WRAP_CLASS); 36 | cm.addLineClass(line, "background", BACK_CLASS); 37 | cm.state.activeLine = line; 38 | } 39 | })(); 40 | -------------------------------------------------------------------------------- /demo/codemirror/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: CSS mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: CSS mode

14 |
49 | 52 | 53 |

MIME types defined: text/css.

54 | 55 |

Parsing/Highlighting Tests: normal, verbose.

56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /demo/codemirror/demo/closetag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Close-Tag Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |

Close-Tag Demo

21 |
    22 |
  • Type an html tag. When you type '>' or '/', the tag will auto-close/complete. Block-level tags will indent.
  • 23 |
  • There are options for disabling tag closing or customizing the list of tags to indent.
  • 24 |
  • Works with "text/html" (based on htmlmixed.js or xml.js) mode.
  • 25 |
  • View source for key binding details.
  • 26 |
27 | 28 |
29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demo/codemirror/theme/vibrant-ink.css: -------------------------------------------------------------------------------- 1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */ 2 | 3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; } 4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } 5 | 6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } 8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } 9 | 10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; } 11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; } 12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; } 13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; } 14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D } 15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D } 16 | .cm-s-vibrant-ink .cm-operator { color: #888; } 17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } 18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C } 19 | .cm-s-vibrant-ink .cm-string-2 { color: red } 20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } 21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } 22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } 23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } 24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } 25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; } 26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } 27 | .cm-s-vibrant-ink .cm-link { color: blue; } 28 | -------------------------------------------------------------------------------- /demo/codemirror/demo/matchhighlighter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Match Highlighter Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 21 | 22 |

CodeMirror: Match Highlighter Demo

23 | 24 |
27 | 28 | 34 | 35 |

Search and highlight occurences of the selected text.

36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demo/codemirror/theme/3024-day.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: 3024 day 4 | Author: Jan T. Sott (http://github.com/idleberg) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} 12 | .cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} 13 | .cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} 14 | .cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;} 15 | .cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;} 16 | 17 | .cm-s-3024-day span.cm-comment {color: #cdab53;} 18 | .cm-s-3024-day span.cm-atom {color: #a16a94;} 19 | .cm-s-3024-day span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;} 22 | .cm-s-3024-day span.cm-keyword {color: #db2d20;} 23 | .cm-s-3024-day span.cm-string {color: #fded02;} 24 | 25 | .cm-s-3024-day span.cm-variable {color: #01a252;} 26 | .cm-s-3024-day span.cm-variable-2 {color: #01a0e4;} 27 | .cm-s-3024-day span.cm-def {color: #e8bbd0;} 28 | .cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;} 29 | .cm-s-3024-day span.cm-bracket {color: #3a3432;} 30 | .cm-s-3024-day span.cm-tag {color: #db2d20;} 31 | .cm-s-3024-day span.cm-link {color: #a16a94;} 32 | 33 | .cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | -------------------------------------------------------------------------------- /demo/codemirror/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function() { 2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", 3 | "loop", "none", "self", "super", "if", "as", "not", "and", 4 | "else", "import", "with", "without", "context"]; 5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 6 | 7 | function tokenBase (stream, state) { 8 | var ch = stream.next(); 9 | if (ch == "{") { 10 | if (ch = stream.eat(/\{|%|#/)) { 11 | stream.eat("-"); 12 | state.tokenize = inTag(ch); 13 | return "tag"; 14 | } 15 | } 16 | } 17 | function inTag (close) { 18 | if (close == "{") { 19 | close = "}"; 20 | } 21 | return function (stream, state) { 22 | var ch = stream.next(); 23 | if ((ch == close || (ch == "-" && stream.eat(close))) 24 | && stream.eat("}")) { 25 | state.tokenize = tokenBase; 26 | return "tag"; 27 | } 28 | if (stream.match(keywords)) { 29 | return "keyword"; 30 | } 31 | return close == "#" ? "comment" : "string"; 32 | }; 33 | } 34 | return { 35 | startState: function () { 36 | return {tokenize: tokenBase}; 37 | }, 38 | token: function (stream, state) { 39 | return state.tokenize(stream, state); 40 | } 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /demo/codemirror/mode/shell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Shell mode 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: Shell mode

17 | 18 | 42 | 43 | 50 | 51 |

MIME types defined: text/x-sh.

52 | -------------------------------------------------------------------------------- /demo/codemirror/theme/twilight.css: -------------------------------------------------------------------------------- 1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ 2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ 3 | 4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } 5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; } 6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } 7 | 8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ 9 | .cm-s-twilight .cm-atom { color: #FC0; } 10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/ 11 | .cm-s-twilight .cm-def { color: #8DA6CE; } 12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ 13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ 14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/ 15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ 16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ 17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ 18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ 19 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; } 20 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ 21 | .cm-s-twilight .cm-tag { color: #997643; } /**/ 22 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ 23 | .cm-s-twilight .cm-header { color: #FF6400; } 24 | .cm-s-twilight .cm-hr { color: #AEAEAE; } 25 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ 26 | 27 | -------------------------------------------------------------------------------- /demo/codemirror/mode/r/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /demo/codemirror/mode/ruby/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /demo/codemirror/theme/3024-night.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: 3024 night 4 | Author: Jan T. Sott (http://github.com/idleberg) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;} 12 | .cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;} 13 | .cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;} 14 | .cm-s-3024-night .CodeMirror-linenumber {color: #5c5855;} 15 | .cm-s-3024-night .CodeMirror-cursor {border-left: 1px solid #807d7c !important;} 16 | 17 | .cm-s-3024-night span.cm-comment {color: #cdab53;} 18 | .cm-s-3024-night span.cm-atom {color: #a16a94;} 19 | .cm-s-3024-night span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute {color: #01a252;} 22 | .cm-s-3024-night span.cm-keyword {color: #db2d20;} 23 | .cm-s-3024-night span.cm-string {color: #fded02;} 24 | 25 | .cm-s-3024-night span.cm-variable {color: #01a252;} 26 | .cm-s-3024-night span.cm-variable-2 {color: #01a0e4;} 27 | .cm-s-3024-night span.cm-def {color: #e8bbd0;} 28 | .cm-s-3024-night span.cm-error {background: #db2d20; color: #807d7c;} 29 | .cm-s-3024-night span.cm-bracket {color: #d6d5d4;} 30 | .cm-s-3024-night span.cm-tag {color: #db2d20;} 31 | .cm-s-3024-night span.cm-link {color: #a16a94;} 32 | 33 | .cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code blast plugin for Codemirror 5 | 6 | 7 | 8 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/codemirror/theme/base16-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Base16 Default Dark 4 | Author: Chris Kempson (http://chriskempson.com) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;} 12 | .cm-s-base16-dark div.CodeMirror-selected {background: #202020 !important;} 13 | .cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;} 14 | .cm-s-base16-dark .CodeMirror-linenumber {color: #505050;} 15 | .cm-s-base16-dark .CodeMirror-cursor {border-left: 1px solid #b0b0b0 !important;} 16 | 17 | .cm-s-base16-dark span.cm-comment {color: #8f5536;} 18 | .cm-s-base16-dark span.cm-atom {color: #aa759f;} 19 | .cm-s-base16-dark span.cm-number {color: #aa759f;} 20 | 21 | .cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute {color: #90a959;} 22 | .cm-s-base16-dark span.cm-keyword {color: #ac4142;} 23 | .cm-s-base16-dark span.cm-string {color: #f4bf75;} 24 | 25 | .cm-s-base16-dark span.cm-variable {color: #90a959;} 26 | .cm-s-base16-dark span.cm-variable-2 {color: #6a9fb5;} 27 | .cm-s-base16-dark span.cm-def {color: #d28445;} 28 | .cm-s-base16-dark span.cm-error {background: #ac4142; color: #b0b0b0;} 29 | .cm-s-base16-dark span.cm-bracket {color: #e0e0e0;} 30 | .cm-s-base16-dark span.cm-tag {color: #ac4142;} 31 | .cm-s-base16-dark span.cm-link {color: #aa759f;} 32 | 33 | .cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | -------------------------------------------------------------------------------- /demo/codemirror/theme/base16-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Base16 Default Light 4 | Author: Chris Kempson (http://chriskempson.com) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;} 12 | .cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;} 13 | .cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;} 14 | .cm-s-base16-light .CodeMirror-linenumber {color: #b0b0b0;} 15 | .cm-s-base16-light .CodeMirror-cursor {border-left: 1px solid #505050 !important;} 16 | 17 | .cm-s-base16-light span.cm-comment {color: #8f5536;} 18 | .cm-s-base16-light span.cm-atom {color: #aa759f;} 19 | .cm-s-base16-light span.cm-number {color: #aa759f;} 20 | 21 | .cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute {color: #90a959;} 22 | .cm-s-base16-light span.cm-keyword {color: #ac4142;} 23 | .cm-s-base16-light span.cm-string {color: #f4bf75;} 24 | 25 | .cm-s-base16-light span.cm-variable {color: #90a959;} 26 | .cm-s-base16-light span.cm-variable-2 {color: #6a9fb5;} 27 | .cm-s-base16-light span.cm-def {color: #d28445;} 28 | .cm-s-base16-light span.cm-error {background: #ac4142; color: #505050;} 29 | .cm-s-base16-light span.cm-bracket {color: #202020;} 30 | .cm-s-base16-light span.cm-tag {color: #ac4142;} 31 | .cm-s-base16-light span.cm-link {color: #aa759f;} 32 | 33 | .cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | -------------------------------------------------------------------------------- /demo/codemirror/keymap/extra.js: -------------------------------------------------------------------------------- 1 | // A number of additional default bindings that are too obscure to 2 | // include in the core codemirror.js file. 3 | 4 | (function() { 5 | "use strict"; 6 | 7 | var Pos = CodeMirror.Pos; 8 | 9 | function moveLines(cm, start, end, dist) { 10 | if (!dist || start > end) return 0; 11 | 12 | var from = cm.clipPos(Pos(start, 0)), to = cm.clipPos(Pos(end)); 13 | var text = cm.getRange(from, to); 14 | 15 | if (start <= cm.firstLine()) 16 | cm.replaceRange("", from, Pos(to.line + 1, 0)); 17 | else 18 | cm.replaceRange("", Pos(from.line - 1), to); 19 | var target = from.line + dist; 20 | if (target <= cm.firstLine()) { 21 | cm.replaceRange(text + "\n", Pos(target, 0)); 22 | return cm.firstLine() - from.line; 23 | } else { 24 | var targetPos = cm.clipPos(Pos(target - 1)); 25 | cm.replaceRange("\n" + text, targetPos); 26 | return targetPos.line + 1 - from.line; 27 | } 28 | } 29 | 30 | function moveSelectedLines(cm, dist) { 31 | var head = cm.getCursor("head"), anchor = cm.getCursor("anchor"); 32 | cm.operation(function() { 33 | var moved = moveLines(cm, Math.min(head.line, anchor.line), Math.max(head.line, anchor.line), dist); 34 | cm.setSelection(Pos(anchor.line + moved, anchor.ch), Pos(head.line + moved, head.ch)); 35 | }); 36 | } 37 | 38 | CodeMirror.commands.moveLinesUp = function(cm) { moveSelectedLines(cm, -1); }; 39 | CodeMirror.commands.moveLinesDown = function(cm) { moveSelectedLines(cm, 1); }; 40 | 41 | CodeMirror.keyMap["default"]["Alt-Up"] = "moveLinesUp"; 42 | CodeMirror.keyMap["default"]["Alt-Down"] = "moveLinesDown"; 43 | })(); 44 | -------------------------------------------------------------------------------- /demo/codemirror/demo/changemode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Mode-Changing Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |

CodeMirror: Mode-Changing demo

18 | 19 |
26 | 27 |

On changes to the content of the above editor, a (crude) script 28 | tries to auto-detect the language used, and switches the editor to 29 | either JavaScript or Scheme mode based on that.

30 | 31 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /demo/codemirror/addon/edit/matchtags.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | CodeMirror.defineOption("matchTags", false, function(cm, val, old) { 5 | if (old && old != CodeMirror.Init) { 6 | cm.off("cursorActivity", doMatchTags); 7 | cm.off("viewportChange", maybeUpdateMatch); 8 | clear(cm); 9 | } 10 | if (val) { 11 | cm.on("cursorActivity", doMatchTags); 12 | cm.on("viewportChange", maybeUpdateMatch); 13 | doMatchTags(cm); 14 | } 15 | }); 16 | 17 | function clear(cm) { 18 | if (cm.state.matchedTag) { 19 | cm.state.matchedTag.clear(); 20 | cm.state.matchedTag = null; 21 | } 22 | } 23 | 24 | function doMatchTags(cm) { 25 | cm.state.failedTagMatch = false; 26 | cm.operation(function() { 27 | clear(cm); 28 | var cur = cm.getCursor(), range = cm.getViewport(); 29 | range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to); 30 | var match = CodeMirror.findMatchingTag(cm, cur, range); 31 | if (!match) return; 32 | var other = match.at == "close" ? match.open : match.close; 33 | if (other) 34 | cm.state.matchedTag = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"}); 35 | else 36 | cm.state.failedTagMatch = true; 37 | }); 38 | } 39 | 40 | function maybeUpdateMatch(cm) { 41 | if (cm.state.failedTagMatch) doMatchTags(cm); 42 | } 43 | 44 | CodeMirror.commands.toMatchingTag = function(cm) { 45 | var found = CodeMirror.findMatchingTag(cm, cm.getCursor()); 46 | if (found) { 47 | var other = found.at == "close" ? found.open : found.close; 48 | if (other) cm.setSelection(other.to, other.from); 49 | } 50 | }; 51 | })(); 52 | -------------------------------------------------------------------------------- /demo/codemirror/theme/midnight.css: -------------------------------------------------------------------------------- 1 | /* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */ 2 | 3 | /**/ 4 | .cm-s-midnight span.CodeMirror-matchhighlight { background: #494949 } 5 | .cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; } 6 | 7 | /**/ 8 | .cm-s-midnight .activeline {background: #253540 !important;} 9 | 10 | .cm-s-midnight.CodeMirror { 11 | background: #0F192A; 12 | color: #D1EDFF; 13 | } 14 | 15 | .cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} 16 | 17 | .cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;} 18 | .cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;} 19 | .cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;} 20 | .cm-s-midnight .CodeMirror-cursor { 21 | border-left: 1px solid #F8F8F0 !important; 22 | } 23 | 24 | .cm-s-midnight span.cm-comment {color: #428BDD;} 25 | .cm-s-midnight span.cm-atom {color: #AE81FF;} 26 | .cm-s-midnight span.cm-number {color: #D1EDFF;} 27 | 28 | .cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute {color: #A6E22E;} 29 | .cm-s-midnight span.cm-keyword {color: #E83737;} 30 | .cm-s-midnight span.cm-string {color: #1DC116;} 31 | 32 | .cm-s-midnight span.cm-variable {color: #FFAA3E;} 33 | .cm-s-midnight span.cm-variable-2 {color: #FFAA3E;} 34 | .cm-s-midnight span.cm-def {color: #4DD;} 35 | .cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;} 36 | .cm-s-midnight span.cm-bracket {color: #D1EDFF;} 37 | .cm-s-midnight span.cm-tag {color: #008;} 38 | .cm-s-midnight span.cm-link {color: #AE81FF;} 39 | 40 | .cm-s-midnight .CodeMirror-matchingbracket { 41 | text-decoration: underline; 42 | color: white !important; 43 | } 44 | -------------------------------------------------------------------------------- /demo/codemirror/demo/html5complete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTML completion demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 |

HTML completion demo

25 |

Shows the XML completer 26 | parameterized with information about the tags in HTML. 27 | Press ctrl-space to activate completion.

28 | 29 |
30 | 31 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /demo/codemirror/demo/variableheight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Variable Height Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |

CodeMirror: Variable Height Demo

20 | 21 |
44 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /demo/codemirror/mode/gas/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Gas mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Gas mode

14 | 15 |
16 | 38 |
39 | 40 | 46 | 47 |

Handles AT&T assembler syntax (more specifically this handles 48 | the GNU Assembler (gas) syntax.) 49 | It takes a single optional configuration parameter: 50 | architecture, which can be one of "ARM", 51 | "ARMv6" or "x86". 52 | Including the parameter adds syntax for the registers and special 53 | directives for the supplied architecture. 54 | 55 |

MIME types defined: text/x-gas

56 | 57 | 58 | -------------------------------------------------------------------------------- /demo/codemirror/demo/visibletabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Visible tabs demo 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

CodeMirror: Visible tabs demo

22 | 23 |
38 | 39 |

Tabs inside the editor are spans with the 40 | class cm-tab, and can be styled.

41 | 42 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /demo/codemirror/mode/tiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Tiki wiki mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Tiki wiki mode

14 | 15 |
72 | 73 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /demo/codemirror/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Smalltalk mode 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 |

CodeMirror: Smalltalk mode

19 | 20 |
43 | 44 | 52 | 53 |

Simple Smalltalk mode.

54 | 55 |

MIME types defined: text/x-stsrc.

56 | 57 | 58 | -------------------------------------------------------------------------------- /demo/codemirror/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: XML mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: XML mode

14 |
26 | 32 |

The XML mode supports two configuration parameters:

33 |
34 |
htmlMode (boolean)
35 |
This switches the mode to parse HTML instead of XML. This 36 | means attributes do not have to be quoted, and some elements 37 | (such as br) do not require a closing tag.
38 |
alignCDATA (boolean)
39 |
Setting this to true will force the opening tag of CDATA 40 | blocks to not be indented.
41 |
42 | 43 |

MIME types defined: application/xml, text/html.

44 | 45 | 46 | -------------------------------------------------------------------------------- /demo/codemirror/theme/tomorrow-night-eighties.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Tomorrow Night - Eighties 4 | Author: Chris Kempson 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;} 12 | .cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;} 13 | .cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;} 14 | .cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;} 15 | .cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} 16 | 17 | .cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;} 18 | .cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;} 19 | .cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;} 22 | .cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;} 23 | .cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;} 24 | 25 | .cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;} 26 | .cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;} 27 | .cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;} 28 | .cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a; color: #6A6A6A;} 29 | .cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;} 30 | .cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;} 31 | .cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;} 32 | 33 | .cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | -------------------------------------------------------------------------------- /demo/codemirror/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: PHP mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

CodeMirror: PHP mode

20 | 21 |
32 | 33 | 44 | 45 |

Simple HTML/PHP mode based on 46 | the C-like mode. Depends on XML, 47 | JavaScript, CSS, HTMLMixed, and C-like modes.

48 | 49 |

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

50 | 51 | 52 | -------------------------------------------------------------------------------- /demo/codemirror/demo/marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Breakpoint Demo 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 |

CodeMirror: Breakpoint demo

19 | 20 |
37 | 38 |

Click the line-number gutter to add or remove 'breakpoints'.

39 | 40 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /demo/codemirror/mode/htmlembedded/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Html Embedded Scripts mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

CodeMirror: Html Embedded Scripts mode

18 | 19 |
31 | 32 | 42 | 43 |

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on 44 | JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

45 | 46 |

MIME types defined: application/x-aspx (ASP.NET), 47 | application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/codemirror/addon/display/placeholder.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | CodeMirror.defineOption("placeholder", "", function(cm, val, old) { 3 | var prev = old && old != CodeMirror.Init; 4 | if (val && !prev) { 5 | cm.on("focus", onFocus); 6 | cm.on("blur", onBlur); 7 | cm.on("change", onChange); 8 | onChange(cm); 9 | } else if (!val && prev) { 10 | cm.off("focus", onFocus); 11 | cm.off("blur", onBlur); 12 | cm.off("change", onChange); 13 | clearPlaceholder(cm); 14 | var wrapper = cm.getWrapperElement(); 15 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); 16 | } 17 | 18 | if (val && !cm.hasFocus()) onBlur(cm); 19 | }); 20 | 21 | function clearPlaceholder(cm) { 22 | if (cm.state.placeholder) { 23 | cm.state.placeholder.parentNode.removeChild(cm.state.placeholder); 24 | cm.state.placeholder = null; 25 | } 26 | } 27 | function setPlaceholder(cm) { 28 | clearPlaceholder(cm); 29 | var elt = cm.state.placeholder = document.createElement("pre"); 30 | elt.style.cssText = "height: 0; overflow: visible"; 31 | elt.className = "CodeMirror-placeholder"; 32 | elt.appendChild(document.createTextNode(cm.getOption("placeholder"))); 33 | cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); 34 | } 35 | 36 | function onFocus(cm) { 37 | clearPlaceholder(cm); 38 | } 39 | function onBlur(cm) { 40 | if (isEmpty(cm)) setPlaceholder(cm); 41 | } 42 | function onChange(cm) { 43 | var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); 44 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); 45 | 46 | if (cm.hasFocus()) return; 47 | if (empty) setPlaceholder(cm); 48 | else clearPlaceholder(cm); 49 | } 50 | 51 | function isEmpty(cm) { 52 | return (cm.lineCount() === 1) && (cm.getLine(0) === ""); 53 | } 54 | })(); 55 | -------------------------------------------------------------------------------- /demo/codemirror/addon/edit/continuecomment.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var modes = ["clike", "css", "javascript"]; 3 | for (var i = 0; i < modes.length; ++i) 4 | CodeMirror.extendMode(modes[i], {blockCommentStart: "/*", 5 | blockCommentEnd: "*/", 6 | blockCommentContinue: " * "}); 7 | 8 | function continueComment(cm) { 9 | var pos = cm.getCursor(), token = cm.getTokenAt(pos); 10 | var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode; 11 | var space; 12 | 13 | if (token.type == "comment" && mode.blockCommentStart) { 14 | var end = token.string.indexOf(mode.blockCommentEnd); 15 | var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found; 16 | if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) { 17 | // Comment ended, don't continue it 18 | } else if (token.string.indexOf(mode.blockCommentStart) == 0) { 19 | space = full.slice(0, token.start); 20 | if (!/^\s*$/.test(space)) { 21 | space = ""; 22 | for (var i = 0; i < token.start; ++i) space += " "; 23 | } 24 | } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 && 25 | found + mode.blockCommentContinue.length > token.start && 26 | /^\s*$/.test(full.slice(0, found))) { 27 | space = full.slice(0, found); 28 | } 29 | } 30 | 31 | if (space != null) 32 | cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end"); 33 | else 34 | return CodeMirror.Pass; 35 | } 36 | 37 | CodeMirror.defineOption("continueComments", null, function(cm, val, prev) { 38 | if (prev && prev != CodeMirror.Init) 39 | cm.removeKeyMap("continueComment"); 40 | var map = {name: "continueComment"}; 41 | map[typeof val == "string" ? val : "Enter"] = continueComment; 42 | cm.addKeyMap(map); 43 | }); 44 | })(); 45 | -------------------------------------------------------------------------------- /demo/codemirror/bin/source-highlight: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Simple command-line code highlighting tool. Reads code from stdin, 4 | // spits html to stdout. For example: 5 | // 6 | // echo 'function foo(a) { return a; }' | bin/source-highlight -s javascript 7 | // bin/source-highlight -s 8 | 9 | var fs = require("fs"); 10 | 11 | CodeMirror = require("../addon/runmode/runmode.node.js"); 12 | require("../mode/meta.js"); 13 | 14 | var sPos = process.argv.indexOf("-s"); 15 | if (sPos == -1 || sPos == process.argv.length - 1) { 16 | console.error("Usage: source-highlight -s language"); 17 | process.exit(1); 18 | } 19 | var lang = process.argv[sPos + 1].toLowerCase(), modeName = lang; 20 | CodeMirror.modeInfo.forEach(function(info) { 21 | if (info.mime == lang) { 22 | modeName = info.mode; 23 | } else if (info.name.toLowerCase() == lang) { 24 | modeName = info.mode; 25 | lang = info.mime; 26 | } 27 | }); 28 | 29 | function ensureMode(name) { 30 | if (CodeMirror.modes[name] || name == "null") return; 31 | try { 32 | require("../mode/" + name + "/" + name + ".js"); 33 | } catch(e) { 34 | console.error("Could not load mode " + name + "."); 35 | process.exit(1); 36 | } 37 | var obj = CodeMirror.modes[name]; 38 | if (obj.dependencies) obj.dependencies.forEach(ensureMode); 39 | } 40 | ensureMode(modeName); 41 | 42 | function esc(str) { 43 | return str.replace(/[<&]/, function(ch) { return ch == "&" ? "&" : "<"; }); 44 | } 45 | 46 | var code = fs.readFileSync("/dev/stdin", "utf8"); 47 | var curStyle = null, accum = ""; 48 | function flush() { 49 | if (curStyle) process.stdout.write("" + esc(accum) + ""); 50 | else process.stdout.write(esc(accum)); 51 | } 52 | 53 | CodeMirror.runMode(code, lang, function(text, style) { 54 | if (style != curStyle) { 55 | flush(); 56 | curStyle = style; accum = text; 57 | } else { 58 | accum += text; 59 | } 60 | }); 61 | flush(); 62 | -------------------------------------------------------------------------------- /demo/codemirror/addon/mode/loadmode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; 3 | 4 | var loading = {}; 5 | function splitCallback(cont, n) { 6 | var countDown = n; 7 | return function() { if (--countDown == 0) cont(); }; 8 | } 9 | function ensureDeps(mode, cont) { 10 | var deps = CodeMirror.modes[mode].dependencies; 11 | if (!deps) return cont(); 12 | var missing = []; 13 | for (var i = 0; i < deps.length; ++i) { 14 | if (!CodeMirror.modes.hasOwnProperty(deps[i])) 15 | missing.push(deps[i]); 16 | } 17 | if (!missing.length) return cont(); 18 | var split = splitCallback(cont, missing.length); 19 | for (var i = 0; i < missing.length; ++i) 20 | CodeMirror.requireMode(missing[i], split); 21 | } 22 | 23 | CodeMirror.requireMode = function(mode, cont) { 24 | if (typeof mode != "string") mode = mode.name; 25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); 26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); 27 | 28 | var script = document.createElement("script"); 29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode); 30 | var others = document.getElementsByTagName("script")[0]; 31 | others.parentNode.insertBefore(script, others); 32 | var list = loading[mode] = [cont]; 33 | var count = 0, poll = setInterval(function() { 34 | if (++count > 100) return clearInterval(poll); 35 | if (CodeMirror.modes.hasOwnProperty(mode)) { 36 | clearInterval(poll); 37 | loading[mode] = null; 38 | ensureDeps(mode, function() { 39 | for (var i = 0; i < list.length; ++i) list[i](); 40 | }); 41 | } 42 | }, 200); 43 | }; 44 | 45 | CodeMirror.autoLoadMode = function(instance, mode) { 46 | if (!CodeMirror.modes.hasOwnProperty(mode)) 47 | CodeMirror.requireMode(mode, function() { 48 | instance.setOption("mode", instance.getOption("mode")); 49 | }); 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /demo/codemirror/mode/properties/properties.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("properties", function() { 2 | return { 3 | token: function(stream, state) { 4 | var sol = stream.sol() || state.afterSection; 5 | var eol = stream.eol(); 6 | 7 | state.afterSection = false; 8 | 9 | if (sol) { 10 | if (state.nextMultiline) { 11 | state.inMultiline = true; 12 | state.nextMultiline = false; 13 | } else { 14 | state.position = "def"; 15 | } 16 | } 17 | 18 | if (eol && ! state.nextMultiline) { 19 | state.inMultiline = false; 20 | state.position = "def"; 21 | } 22 | 23 | if (sol) { 24 | while(stream.eatSpace()); 25 | } 26 | 27 | var ch = stream.next(); 28 | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 30 | state.position = "comment"; 31 | stream.skipToEnd(); 32 | return "comment"; 33 | } else if (sol && ch === "[") { 34 | state.afterSection = true; 35 | stream.skipTo("]"); stream.eat("]"); 36 | return "header"; 37 | } else if (ch === "=" || ch === ":") { 38 | state.position = "quote"; 39 | return null; 40 | } else if (ch === "\\" && state.position === "quote") { 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 42 | // Multiline value 43 | state.nextMultiline = true; 44 | } 45 | } 46 | 47 | return state.position; 48 | }, 49 | 50 | startState: function() { 51 | return { 52 | position : "def", // Current position, "def", "quote" or "comment" 53 | nextMultiline : false, // Is the next line multiline value 54 | inMultiline : false, // Is the current line a multiline value 55 | afterSection : false // Did we just open a section 56 | }; 57 | } 58 | 59 | }; 60 | }); 61 | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); 63 | CodeMirror.defineMIME("text/x-ini", "properties"); 64 | -------------------------------------------------------------------------------- /demo/codemirror/mode/rpm/changes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: RPM changes mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: RPM changes mode

14 | 15 |
42 | 50 | 51 |

MIME types defined: text/x-rpm-changes.

52 | 53 | 54 | -------------------------------------------------------------------------------- /demo/codemirror/test/comment_test.js: -------------------------------------------------------------------------------- 1 | namespace = "comment_"; 2 | 3 | (function() { 4 | function test(name, mode, run, before, after) { 5 | return testCM(name, function(cm) { 6 | run(cm); 7 | eq(cm.getValue(), after); 8 | }, {value: before, mode: mode}); 9 | } 10 | 11 | var simpleProg = "function foo() {\n return bar;\n}"; 12 | 13 | test("block", "javascript", function(cm) { 14 | cm.blockComment(Pos(0, 3), Pos(3, 0), {blockCommentLead: " *"}); 15 | }, simpleProg + "\n", "/* function foo() {\n * return bar;\n * }\n */"); 16 | 17 | test("blockToggle", "javascript", function(cm) { 18 | cm.blockComment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"}); 19 | cm.uncomment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"}); 20 | }, simpleProg, simpleProg); 21 | 22 | test("line", "javascript", function(cm) { 23 | cm.lineComment(Pos(1, 1), Pos(1, 1)); 24 | }, simpleProg, "function foo() {\n// return bar;\n}"); 25 | 26 | test("lineToggle", "javascript", function(cm) { 27 | cm.lineComment(Pos(0, 0), Pos(2, 1)); 28 | cm.uncomment(Pos(0, 0), Pos(2, 1)); 29 | }, simpleProg, simpleProg); 30 | 31 | test("fallbackToBlock", "css", function(cm) { 32 | cm.lineComment(Pos(0, 0), Pos(2, 1)); 33 | }, "html {\n border: none;\n}", "/* html {\n border: none;\n} */"); 34 | 35 | test("fallbackToLine", "ruby", function(cm) { 36 | cm.blockComment(Pos(0, 0), Pos(1)); 37 | }, "def blah()\n return hah\n", "# def blah()\n# return hah\n"); 38 | 39 | test("commentRange", "javascript", function(cm) { 40 | cm.blockComment(Pos(1, 2), Pos(1, 13), {fullLines: false}); 41 | }, simpleProg, "function foo() {\n /*return bar;*/\n}"); 42 | 43 | test("indented", "javascript", function(cm) { 44 | cm.lineComment(Pos(1, 0), Pos(2), {indent: true}); 45 | }, simpleProg, "function foo() {\n // return bar;\n // }"); 46 | 47 | test("singleEmptyLine", "javascript", function(cm) { 48 | cm.setCursor(1); 49 | cm.execCommand("toggleComment"); 50 | }, "a;\n\nb;", "a;\n// \nb;"); 51 | })(); 52 | -------------------------------------------------------------------------------- /demo/codemirror/mode/apl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: APL mode 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: APL mode

17 | 18 |
44 | 45 | 52 | 53 |

Simple mode that tries to handle APL as well as it can.

54 |

It attempts to label functions/operators based upon 55 | monadic/dyadic usage (but this is far from fully fleshed out). 56 | This means there are meaningful classnames so hover states can 57 | have popups etc.

58 | 59 |

MIME types defined: text/apl (APL code)

60 | 61 | 62 | -------------------------------------------------------------------------------- /demo/codemirror/mode/haml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HAML mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

CodeMirror: HAML mode

18 |
55 | 61 | 62 |

MIME types defined: text/x-haml.

63 | 64 |

Parsing/Highlighting Tests: normal, verbose.

65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /demo/codemirror/demo/mustache.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Overlay Parser Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 |

CodeMirror: Overlay Parser Demo

19 | 20 |
31 | 32 | 51 | 52 |

Demonstration of a mode that parses HTML, highlighting 53 | the Mustache templating 54 | directives inside of it by using the code 55 | in overlay.js. View 56 | source to see the 15 lines of code needed to accomplish this.

57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /demo/codemirror/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: YAML mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: YAML mode

14 |
61 | 64 | 65 |

MIME types defined: text/x-yaml.

66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /demo/codemirror/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Lua mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Lua mode

16 |
57 | 64 | 65 |

Loosely based on Franciszek 66 | Wawrzak's CodeMirror 67 | 1 mode. One configuration parameter is 68 | supported, specials, to which you can provide an 69 | array of strings to have those identifiers highlighted with 70 | the lua-special style.

71 |

MIME types defined: text/x-lua.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /demo/codemirror/mode/erlang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Erlang mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Erlang mode

16 | 17 |
52 | 53 | 61 | 62 |

MIME types defined: text/x-erlang.

63 | 64 | 65 | -------------------------------------------------------------------------------- /demo/codemirror/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Haskell mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Haskell mode

16 | 17 |
51 | 52 | 59 | 60 |

MIME types defined: text/x-haskell.

61 | 62 | 63 | -------------------------------------------------------------------------------- /demo/codemirror/mode/groovy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Groovy mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CodeMirror: Groovy mode

15 | 16 |
62 | 63 | 70 | 71 |

MIME types defined: text/x-groovy

72 | 73 | 74 | -------------------------------------------------------------------------------- /demo/codemirror/mode/jade/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Jade Templating Mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Jade Templating Mode

14 |
44 | 50 |

The Jade Templating Mode

51 |

Created by Drew Bratcher. Managed as part of an Adobe Brackets extension at https://github.com/dbratcher/brackets-jade.

52 |

MIME type defined: text/x-jade.

53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/codemirror/demo/multiplex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Multiplexing Parser Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 |

CodeMirror: Multiplexing Parser Demo

19 | 20 |
33 | 34 | 50 | 51 |

Demonstration of a multiplexing mode, which, at certain 52 | boundary strings, switches to one or more inner modes. The out 53 | (HTML) mode does not get fed the content of the << 54 | >> blocks. See 55 | the manual and 56 | the source for more 57 | information.

58 | 59 |

60 | Parsing/Highlighting Tests: 61 | normal, 62 | verbose. 63 |

64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /demo/codemirror/mode/go/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Go mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Go mode

16 | 17 |
60 | 61 | 71 | 72 |

MIME type: text/x-go

73 | 74 | 75 | -------------------------------------------------------------------------------- /demo/codemirror/addon/runmode/runmode.js: -------------------------------------------------------------------------------- 1 | CodeMirror.runMode = function(string, modespec, callback, options) { 2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); 3 | var ie = /MSIE \d/.test(navigator.userAgent); 4 | var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); 5 | 6 | if (callback.nodeType == 1) { 7 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; 8 | var node = callback, col = 0; 9 | node.innerHTML = ""; 10 | callback = function(text, style) { 11 | if (text == "\n") { 12 | // Emitting LF or CRLF on IE8 or earlier results in an incorrect display. 13 | // Emitting a carriage return makes everything ok. 14 | node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text)); 15 | col = 0; 16 | return; 17 | } 18 | var content = ""; 19 | // replace tabs 20 | for (var pos = 0;;) { 21 | var idx = text.indexOf("\t", pos); 22 | if (idx == -1) { 23 | content += text.slice(pos); 24 | col += text.length - pos; 25 | break; 26 | } else { 27 | col += idx - pos; 28 | content += text.slice(pos, idx); 29 | var size = tabSize - col % tabSize; 30 | col += size; 31 | for (var i = 0; i < size; ++i) content += " "; 32 | pos = idx + 1; 33 | } 34 | } 35 | 36 | if (style) { 37 | var sp = node.appendChild(document.createElement("span")); 38 | sp.className = "cm-" + style.replace(/ +/g, " cm-"); 39 | sp.appendChild(document.createTextNode(content)); 40 | } else { 41 | node.appendChild(document.createTextNode(content)); 42 | } 43 | }; 44 | } 45 | 46 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); 47 | for (var i = 0, e = lines.length; i < e; ++i) { 48 | if (i) callback("\n"); 49 | var stream = new CodeMirror.StringStream(lines[i]); 50 | while (!stream.eol()) { 51 | var style = mode.token(stream, state); 52 | callback(stream.current(), style, i, stream.start); 53 | stream.start = stream.pos; 54 | } 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /demo/codemirror/demo/runmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Mode Runner Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Mode Runner Demo

14 | 15 |
21 | 22 |

23 | 
24 |     
30 | 
31 |     

Running a CodeMirror mode outside of the editor. 32 | The CodeMirror.runMode function, defined 33 | in lib/runmode.js takes the following arguments:

34 | 35 |
36 |
text (string)
37 |
The document to run through the highlighter.
38 |
mode (mode spec)
39 |
The mode to use (must be loaded as normal).
40 |
output (function or DOM node)
41 |
If this is a function, it will be called for each token with 42 | two arguments, the token's text and the token's style class (may 43 | be null for unstyled tokens). If it is a DOM node, 44 | the tokens will be converted to span elements as in 45 | an editor, and inserted into the node 46 | (through innerHTML).
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /demo/codemirror/theme/lesser-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | http://lesscss.org/ dark theme 3 | Ported to CodeMirror by Peter Kroon 4 | */ 5 | .cm-s-lesser-dark { 6 | line-height: 1.3em; 7 | } 8 | .cm-s-lesser-dark { 9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; 10 | } 11 | 12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } 13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ 14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ 16 | 17 | .cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ 18 | 19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } 20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } 21 | 22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; } 23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; } 24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; } 25 | .cm-s-lesser-dark span.cm-def {color: white;} 26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } 27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } 28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; } 29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;} 30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;} 31 | .cm-s-lesser-dark span.cm-comment { color: #666; } 32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; } 33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;} 34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; } 35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; } 36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;} 37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } 38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } 39 | .cm-s-lesser-dark span.cm-tag { color: #669199; } 40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;} 41 | .cm-s-lesser-dark span.cm-header {color: #a0a;} 42 | .cm-s-lesser-dark span.cm-quote {color: #090;} 43 | .cm-s-lesser-dark span.cm-hr {color: #999;} 44 | .cm-s-lesser-dark span.cm-link {color: #00c;} 45 | -------------------------------------------------------------------------------- /demo/codemirror/addon/tern/tern.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-Tern-completion { 2 | padding-left: 22px; 3 | position: relative; 4 | } 5 | .CodeMirror-Tern-completion:before { 6 | position: absolute; 7 | left: 2px; 8 | bottom: 2px; 9 | border-radius: 50%; 10 | font-size: 12px; 11 | font-weight: bold; 12 | height: 15px; 13 | width: 15px; 14 | line-height: 16px; 15 | text-align: center; 16 | color: white; 17 | -moz-box-sizing: border-box; 18 | box-sizing: border-box; 19 | } 20 | .CodeMirror-Tern-completion-unknown:before { 21 | content: "?"; 22 | background: #4bb; 23 | } 24 | .CodeMirror-Tern-completion-object:before { 25 | content: "O"; 26 | background: #77c; 27 | } 28 | .CodeMirror-Tern-completion-fn:before { 29 | content: "F"; 30 | background: #7c7; 31 | } 32 | .CodeMirror-Tern-completion-array:before { 33 | content: "A"; 34 | background: #c66; 35 | } 36 | .CodeMirror-Tern-completion-number:before { 37 | content: "1"; 38 | background: #999; 39 | } 40 | .CodeMirror-Tern-completion-string:before { 41 | content: "S"; 42 | background: #999; 43 | } 44 | .CodeMirror-Tern-completion-bool:before { 45 | content: "B"; 46 | background: #999; 47 | } 48 | 49 | .CodeMirror-Tern-completion-guess { 50 | color: #999; 51 | } 52 | 53 | .CodeMirror-Tern-tooltip { 54 | border: 1px solid silver; 55 | border-radius: 3px; 56 | color: #444; 57 | padding: 2px 5px; 58 | font-size: 90%; 59 | font-family: monospace; 60 | background-color: white; 61 | white-space: pre-wrap; 62 | 63 | max-width: 40em; 64 | position: absolute; 65 | z-index: 10; 66 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 67 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 68 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 69 | 70 | transition: opacity 1s; 71 | -moz-transition: opacity 1s; 72 | -webkit-transition: opacity 1s; 73 | -o-transition: opacity 1s; 74 | -ms-transition: opacity 1s; 75 | } 76 | 77 | .CodeMirror-Tern-hint-doc { 78 | max-width: 25em; 79 | } 80 | 81 | .CodeMirror-Tern-fname { color: black; } 82 | .CodeMirror-Tern-farg { color: #70a; } 83 | .CodeMirror-Tern-farg-current { text-decoration: underline; } 84 | .CodeMirror-Tern-type { color: #07c; } 85 | .CodeMirror-Tern-fhint-guess { opacity: .7; } 86 | -------------------------------------------------------------------------------- /demo/codemirror/mode/haxe/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Haxe mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Haxe mode

14 | 15 |
79 | 80 | 87 | 88 |

MIME types defined: text/x-haxe.

89 | 90 | 91 | -------------------------------------------------------------------------------- /demo/codemirror/demo/merge.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | CodeMirror: merge view demo 12 | 23 | 24 | 25 |

CodeMirror: merge view demo

26 | 27 |
28 | 29 |

The merge 30 | addon provides an interface for displaying and merging diffs, 31 | either two-way 32 | or three-way. The left 33 | (or center) pane is editable, and the differences with the other 34 | pane(s) are shown live as you edit it.

35 | 36 |

This addon depends on 37 | the google-diff-match-patch 38 | library to compute the diffs.

39 | 40 | 64 | -------------------------------------------------------------------------------- /demo/codemirror/demo/vim.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Vim bindings demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 |

CodeMirror: Vim bindings demo

21 | 22 |
37 | 38 |
41 | 42 |

The vim keybindings are enabled by 43 | including keymap/vim.js and setting 44 | the keyMap option to "vim". Because 45 | CodeMirror's internal API is quite different from Vim, they are only 46 | a loose approximation of actual vim bindings, though.

47 | 48 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /demo/codemirror/mode/sieve/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Sieve (RFC5228) mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Sieve (RFC5228) mode

14 |
74 | 77 | 78 |

MIME types defined: application/sieve.

79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /demo/codemirror/doc/reporting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Reporting Bugs 6 | 7 | 8 | 9 | 10 | 11 | 12 |

{ } CodeMirror

13 | 14 |
15 | 16 |
17 | /* Reporting bugs
18 |    effectively */
19 | 
20 |
21 | 22 |
23 | 24 |

So you found a problem in CodeMirror. By all means, report it! Bug 25 | reports from users are the main drive behind improvements to 26 | CodeMirror. But first, please read over these points:

27 | 28 |
    29 |
  1. CodeMirror is maintained by volunteers. They don't owe you 30 | anything, so be polite. Reports with an indignant or belligerent 31 | tone tend to be moved to the bottom of the pile.
  2. 32 | 33 |
  3. Include information about the browser in which the 34 | problem occurred. Even if you tested several browsers, and 35 | the problem occurred in all of them, mention this fact in the bug 36 | report. Also include browser version numbers and the operating 37 | system that you're on.
  4. 38 | 39 |
  5. Mention which release of CodeMirror you're using. Preferably, 40 | try also with the current development snapshot, to ensure the 41 | problem has not already been fixed.
  6. 42 | 43 |
  7. Mention very precisely what went wrong. "X is broken" is not a 44 | good bug report. What did you expect to happen? What happened 45 | instead? Describe the exact steps a maintainer has to take to make 46 | the problem occur. We can not fix something that we can not 47 | observe.
  8. 48 | 49 |
  9. If the problem can not be reproduced in any of the demos 50 | included in the CodeMirror distribution, please provide an HTML 51 | document that demonstrates the problem. The best way to do this is 52 | to go to jsbin.com, enter 53 | it there, press save, and include the resulting link in your bug 54 | report.
  10. 55 |
56 | 57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /demo/codemirror/theme/xq-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 by MarkLogic Corporation 3 | Author: Mike Brevoort 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | */ 23 | .cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; } 24 | .cm-s-xq-light span.cm-atom {color: #6C8CD5;} 25 | .cm-s-xq-light span.cm-number {color: #164;} 26 | .cm-s-xq-light span.cm-def {text-decoration:underline;} 27 | .cm-s-xq-light span.cm-variable {color: black; } 28 | .cm-s-xq-light span.cm-variable-2 {color:black;} 29 | .cm-s-xq-light span.cm-variable-3 {color: black; } 30 | .cm-s-xq-light span.cm-property {} 31 | .cm-s-xq-light span.cm-operator {} 32 | .cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;} 33 | .cm-s-xq-light span.cm-string {color: red;} 34 | .cm-s-xq-light span.cm-meta {color: yellow;} 35 | .cm-s-xq-light span.cm-error {color: #f00;} 36 | .cm-s-xq-light span.cm-qualifier {color: grey} 37 | .cm-s-xq-light span.cm-builtin {color: #7EA656;} 38 | .cm-s-xq-light span.cm-bracket {color: #cc7;} 39 | .cm-s-xq-light span.cm-tag {color: #3F7F7F;} 40 | .cm-s-xq-light span.cm-attribute {color: #7F007F;} 41 | 42 | .cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;} 43 | .cm-s-xq-light .CodeMirror-matchingbracket {border:1px solid grey;color:black !important;background:yellow;} -------------------------------------------------------------------------------- /demo/codemirror/addon/mode/overlay.js: -------------------------------------------------------------------------------- 1 | // Utility function that allows modes to be combined. The mode given 2 | // as the base argument takes care of most of the normal mode 3 | // functionality, but a second (typically simple) mode is used, which 4 | // can override the style of text. Both modes get to parse all of the 5 | // text, but when both assign a non-null style to a piece of code, the 6 | // overlay wins, unless the combine argument was true, in which case 7 | // the styles are combined. 8 | 9 | // overlayParser is the old, deprecated name 10 | CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) { 11 | return { 12 | startState: function() { 13 | return { 14 | base: CodeMirror.startState(base), 15 | overlay: CodeMirror.startState(overlay), 16 | basePos: 0, baseCur: null, 17 | overlayPos: 0, overlayCur: null 18 | }; 19 | }, 20 | copyState: function(state) { 21 | return { 22 | base: CodeMirror.copyState(base, state.base), 23 | overlay: CodeMirror.copyState(overlay, state.overlay), 24 | basePos: state.basePos, baseCur: null, 25 | overlayPos: state.overlayPos, overlayCur: null 26 | }; 27 | }, 28 | 29 | token: function(stream, state) { 30 | if (stream.start == state.basePos) { 31 | state.baseCur = base.token(stream, state.base); 32 | state.basePos = stream.pos; 33 | } 34 | if (stream.start == state.overlayPos) { 35 | stream.pos = stream.start; 36 | state.overlayCur = overlay.token(stream, state.overlay); 37 | state.overlayPos = stream.pos; 38 | } 39 | stream.pos = Math.min(state.basePos, state.overlayPos); 40 | if (stream.eol()) state.basePos = state.overlayPos = 0; 41 | 42 | if (state.overlayCur == null) return state.baseCur; 43 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; 44 | else return state.overlayCur; 45 | }, 46 | 47 | indent: base.indent && function(state, textAfter) { 48 | return base.indent(state.base, textAfter); 49 | }, 50 | electricChars: base.electricChars, 51 | 52 | innerMode: function(state) { return {state: state.base, mode: base}; }, 53 | 54 | blankLine: function(state) { 55 | if (base.blankLine) base.blankLine(state.base); 56 | if (overlay.blankLine) overlay.blankLine(state.overlay); 57 | } 58 | }; 59 | }; 60 | -------------------------------------------------------------------------------- /demo/codemirror/mode/gfm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: GFM mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |

CodeMirror: GFM mode

24 | 25 |
60 | 61 | 68 | 69 |

Optionally depends on other modes for properly highlighted code blocks.

70 | 71 |

Parsing/Highlighting Tests: normal, verbose.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /demo/codemirror/demo/indentwrap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Indented wrapped line demo 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Indented wrapped line demo

17 | 18 |
28 | 29 |

This page uses a hack on top of the "renderLine" 30 | event to make wrapped text line up with the base indentation of 31 | the line.

32 | 33 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/codemirror/theme/xq-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 by MarkLogic Corporation 3 | Author: Mike Brevoort 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | */ 23 | .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } 24 | .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; } 25 | .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 26 | .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } 27 | .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 28 | 29 | .cm-s-xq-dark span.cm-keyword {color: #FFBD40;} 30 | .cm-s-xq-dark span.cm-atom {color: #6C8CD5;} 31 | .cm-s-xq-dark span.cm-number {color: #164;} 32 | .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} 33 | .cm-s-xq-dark span.cm-variable {color: #FFF;} 34 | .cm-s-xq-dark span.cm-variable-2 {color: #EEE;} 35 | .cm-s-xq-dark span.cm-variable-3 {color: #DDD;} 36 | .cm-s-xq-dark span.cm-property {} 37 | .cm-s-xq-dark span.cm-operator {} 38 | .cm-s-xq-dark span.cm-comment {color: gray;} 39 | .cm-s-xq-dark span.cm-string {color: #9FEE00;} 40 | .cm-s-xq-dark span.cm-meta {color: yellow;} 41 | .cm-s-xq-dark span.cm-error {color: #f00;} 42 | .cm-s-xq-dark span.cm-qualifier {color: #FFF700;} 43 | .cm-s-xq-dark span.cm-builtin {color: #30a;} 44 | .cm-s-xq-dark span.cm-bracket {color: #cc7;} 45 | .cm-s-xq-dark span.cm-tag {color: #FFBD40;} 46 | .cm-s-xq-dark span.cm-attribute {color: #FFF700;} 47 | -------------------------------------------------------------------------------- /demo/codemirror/demo/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTML5 preview 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 27 | 28 | 29 |

CodeMirror: HTML5 preview

30 | 53 | 54 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /demo/codemirror/mode/clojure/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Clojure mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Clojure mode

14 |
69 | 72 | 73 |

MIME types defined: text/x-clojure.

74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /demo/codemirror/demo/emacs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Emacs bindings demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 |

CodeMirror: Emacs bindings demo

24 | 25 |
40 | 41 |

The emacs keybindings are enabled by 42 | including keymap/emacs.js and setting 43 | the keyMap option to "emacs". Because 44 | CodeMirror's internal API is quite different from Emacs, they are only 45 | a loose approximation of actual emacs bindings, though.

46 | 47 |

Also note that a lot of browsers disallow certain keys from being 48 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the 49 | result that idiomatic use of Emacs keys will constantly close your tab 50 | or open a new window.

51 | 52 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /demo/codemirror/mode/scheme/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Scheme mode 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Scheme mode

14 |
58 | 61 | 62 |

MIME types defined: text/x-scheme.

63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /demo/codemirror/mode/sql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SQL Mode for CodeMirror 6 | 7 | 8 | 9 | 15 | 16 | 35 | 36 | 37 |

SQL Mode for CodeMirror

38 |
39 | 54 |
55 |

MIME types defined: 56 | text/x-sql, 57 | text/x-mysql, 58 | text/x-mariadb, 59 | text/x-cassandra, 60 | text/x-plsql. 61 |

62 |

63 | Tests: 64 | normal, 65 | verbose. 66 |

67 | 68 | 69 | -------------------------------------------------------------------------------- /demo/codemirror/mode/r/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: R mode 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 |

CodeMirror: R mode

20 |
63 | 66 | 67 |

MIME types defined: text/x-rsrc.

68 | 69 |

Development of the CodeMirror R mode was kindly sponsored 70 | by Ubalo, who hold 71 | the license.

72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /demo/codemirror/demo/closebrackets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Closebrackets Demo 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 |

CodeMirror: Closebrackets Demo

18 | 19 |

Type a bracket like '[', '(', '{', '"', or ''' 20 | and the addon 21 | will auto-close it. Type the closing variant when directly in 22 | front of a matching character and it will overwrite it.

23 | 24 |

If you backspace over a starting bracket while inside empty brackets 25 | (e.g. {|}), it will delete the closing bracket for you.

26 | 27 | 28 |
58 | 59 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /demo/codemirror/demo/bidi.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Bi-directional Text Demo 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Bi-directional Text Demo

17 | 18 |
47 | 48 | 55 | 56 |

Demonstration of bi-directional text support. See 57 | the related 58 | blog post for more background.

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /demo/codemirror/addon/fold/foldcode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | function doFold(cm, pos, options) { 5 | var finder = options && (options.call ? options : options.rangeFinder); 6 | if (!finder) finder = cm.getHelper(pos, "fold"); 7 | if (!finder) return; 8 | if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); 9 | var minSize = options && options.minFoldSize || 0; 10 | 11 | function getRange(allowFolded) { 12 | var range = finder(cm, pos); 13 | if (!range || range.to.line - range.from.line < minSize) return null; 14 | var marks = cm.findMarksAt(range.from); 15 | for (var i = 0; i < marks.length; ++i) { 16 | if (marks[i].__isFold) { 17 | if (!allowFolded) return null; 18 | range.cleared = true; 19 | marks[i].clear(); 20 | } 21 | } 22 | return range; 23 | } 24 | 25 | var range = getRange(true); 26 | if (options && options.scanUp) while (!range && pos.line > cm.firstLine()) { 27 | pos = CodeMirror.Pos(pos.line - 1, 0); 28 | range = getRange(false); 29 | } 30 | if (!range || range.cleared) return; 31 | 32 | var myWidget = makeWidget(options); 33 | CodeMirror.on(myWidget, "mousedown", function() { myRange.clear(); }); 34 | var myRange = cm.markText(range.from, range.to, { 35 | replacedWith: myWidget, 36 | clearOnEnter: true, 37 | __isFold: true 38 | }); 39 | myRange.on("clear", function(from, to) { 40 | CodeMirror.signal(cm, "unfold", cm, from, to); 41 | }); 42 | CodeMirror.signal(cm, "fold", cm, range.from, range.to); 43 | } 44 | 45 | function makeWidget(options) { 46 | var widget = (options && options.widget) || "\u2194"; 47 | if (typeof widget == "string") { 48 | var text = document.createTextNode(widget); 49 | widget = document.createElement("span"); 50 | widget.appendChild(text); 51 | widget.className = "CodeMirror-foldmarker"; 52 | } 53 | return widget; 54 | } 55 | 56 | // Clumsy backwards-compatible interface 57 | CodeMirror.newFoldFunction = function(rangeFinder, widget) { 58 | return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; 59 | }; 60 | 61 | // New-style interface 62 | CodeMirror.defineExtension("foldCode", function(pos, options) { doFold(this, pos, options); }); 63 | 64 | CodeMirror.registerHelper("fold", "combine", function() { 65 | var funcs = Array.prototype.slice.call(arguments, 0); 66 | return function(cm, start) { 67 | for (var i = 0; i < funcs.length; ++i) { 68 | var found = funcs[i](cm, start); 69 | if (found) return found; 70 | } 71 | }; 72 | }); 73 | })(); 74 | --------------------------------------------------------------------------------