You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

7 months ago
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/5/LICENSE
  3. (function() {
  4. CodeMirror.defineMode("markdown_with_stex", function(){
  5. var inner = CodeMirror.getMode({}, "stex");
  6. var outer = CodeMirror.getMode({}, "markdown");
  7. var innerOptions = {
  8. open: '$',
  9. close: '$',
  10. mode: inner,
  11. delimStyle: 'delim',
  12. innerStyle: 'inner'
  13. };
  14. return CodeMirror.multiplexingMode(outer, innerOptions);
  15. });
  16. var mode = CodeMirror.getMode({}, "markdown_with_stex");
  17. function MT(name) {
  18. test.mode(
  19. name,
  20. mode,
  21. Array.prototype.slice.call(arguments, 1),
  22. 'multiplexing');
  23. }
  24. MT(
  25. "stexInsideMarkdown",
  26. "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
  27. CodeMirror.defineMode("identical_delim_multiplex", function() {
  28. return CodeMirror.multiplexingMode(CodeMirror.getMode({indentUnit: 2}, "javascript"), {
  29. open: "#",
  30. close: "#",
  31. mode: CodeMirror.getMode({}, "markdown"),
  32. parseDelimiters: true,
  33. innerStyle: "q"
  34. });
  35. });
  36. var mode2 = CodeMirror.getMode({}, "identical_delim_multiplex");
  37. test.mode("identical_delimiters_with_parseDelimiters", mode2, [
  38. "[keyword let] [def x] [operator =] [q #foo][q&em *bar*][q #];"
  39. ], "multiplexing")
  40. })();