Skip to content

Instantly share code, notes, and snippets.

@themeteorchef
Created October 4, 2015 19:17
Show Gist options
  • Select an option

  • Save themeteorchef/9ae8bf296cfe6ee933d6 to your computer and use it in GitHub Desktop.

Select an option

Save themeteorchef/9ae8bf296cfe6ee933d6 to your computer and use it in GitHub Desktop.
Multiplex in CodeMirror
// Taken from the source of the demo here: https://codemirror.net/demo/multiplex.html
CodeMirror.defineMode("demo", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "text/html"),
{open: "<<", close: ">>",
mode: CodeMirror.getMode(config, "text/plain"),
delimStyle: "delimit"}
// .. more multiplexed styles can follow here
);
});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "demo",
lineNumbers: true,
lineWrapping: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment