Codemirror -extrakeys

by jean-philippe janecek

HTML

<link rel="stylesheet" href="https://codemirror.net/theme/ambiance.css">
<script src="https://codemirror.net/lib/codemirror.js"></script>
<link rel="stylesheet" href="https://codemirror.net/lib/codemirror.css">
<script src="https://codemirror.net/3/mode/shell/shell.js"></script>
<form>
  <textarea id="code" name="code">
$ edjangertemplate --list
# Template "demo_httpd"
# Template "demo_jenkins"
# Template "demo_template"
$ edjangertemplate --listinfo
# Template "demo_httpd"
configurations:
  - properties:       ./configuration.properties
    template:         edjanger.template
    image_name:       test/webserver
    from_image:       httpd
    dockerfile:       build/Dockerfile
    container_name:   webtest
    timestamp:        Sam 10 déc 2016 20:35:11 CET

# Template "demo_jenkins"
configurations:
  - properties:       ./configuration.properties
    template:         edjanger.template
    image_name:       demo/jenkins
    from_image:       jenkins
    dockerfile:       build/Dockerfile
    container_name:   jenkins
    timestamp:        Sam 10 déc 2016 23:16:49 CET

# Template "demo_template"
configurations:
...
  </textarea>
</form>

CSS

.CodeMirror {
  border: 1px solid #eee;
  height: auto;
}

JavaScript

$(document).ready(function() {
  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
    mode: 'shell',
    theme: "ambiance",
    lineNumbers: true,
    matchBrackets: true
  });
});