Sha256: c28b0f87c4f03cc9e438941812744cf19f19ef987433ae9ea2708e4ba7121aca
Contents?: true
Size: 1.05 KB
Versions: 8
Compression:
Stored size: 1.05 KB
Contents
/* This overlay provides a 'liquid' mode to the excellent CodeMirror editor (http://codemirror.net/). Add something like this to your CSS: .cm-liquid-tag { color: #32273f; background: #ead9ff; } .cm-liquid-variable { color: #29739b background: #c2e0f0; } */ CodeMirror.defineMode("liquid", function(config, parserConfig) { var liquidOverlay = { token: function(stream, state) { // Variables. if (stream.match("{{")) { while ((ch = stream.next()) != null) if (ch == "}" && stream.next() == "}") break; return "liquid-variable"; } // Tags. if(stream.match("{%")) { while ((ch = stream.next()) != null) if (ch == "%" && stream.next() == "}") break; return "liquid-tag"; } while (stream.next() != null && !stream.match("{{", false) && !stream.match("{%", false)) {} return null; } }; return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), liquidOverlay); });
Version data entries
8 entries across 8 versions & 1 rubygems