1.2.0 • Published 5 years ago

@sgarciac/cm_toml_mode v1.2.0

Weekly downloads
21
License
ISC
Repository
-
Last release
5 years ago

CmTomlMode

A better TOML mode for Codemirror. The current mode offered by codemirror lacks support for some features of TOML version 0.4 such as datetimes and inline tables but also fails to correctly colour some of the more basic types.

You can obtain CmTomlMode via npm:

npm install @sgarciac/cm_toml_mode

of simply copying dist/cm-toml-mode.js

... and writing something like this in your HTML:

<link rel=stylesheet href="codemirror.css">
<script src="codemirror.js"></script>
<script src="cm-toml-mode.web.js"></script>
<script>

  CodeMirror.defineMode("bettertomlmode", CmTomlMode.tomlMode);
</script>

<style>
  .CodeMirror { height: auto; border: 1px solid #ddd; }
  .CodeMirror-scroll { max-height: 200px; }
  .CodeMirror pre { padding-left: 7px; line-height: 1.25; }
</style>

<form style="position: relative; margin-top: .5em;">
  <textarea id="demotext">
</textarea>
</form>
<script>
    var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
      lineNumbers: true,
      mode: "bettertomlmode",
      matchBrackets: true
    });
</script>

You can see this mode in action here

1.2.0

5 years ago

1.1.0

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago