Search code examples
javascriptcodemirror

Where is CodeMirror.js?


For the first time I'm trying to use CodeMirror for template edition of my CMS. In the first page of http://codemirror.net there is the following sample:

<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<script>
  var editor = CodeMirror.fromTextArea(myTextarea, {
    lineNumbers: true
  });
</script>

But on the GitHub page there isn't any codemirror.js file in the lib directory. How should I use this tool?


Solution

  • One way to get CodeMirror is to download it. You can get the file links from the CDN here: https://cdnjs.com/libraries/codemirror

    You just have to put the CDN link in the script or link tag like this:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.32.0/codemirror.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.32.0/codemirror.min.css" />