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.
50 lines
1.3 KiB
50 lines
1.3 KiB
2 years ago
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||
|
|
||
|
(function() {
|
||
|
CodeMirror.defineMode("markdown_with_stex", function(){
|
||
|
var inner = CodeMirror.getMode({}, "stex");
|
||
|
var outer = CodeMirror.getMode({}, "markdown");
|
||
|
|
||
|
var innerOptions = {
|
||
|
open: '$',
|
||
|
close: '$',
|
||
|
mode: inner,
|
||
|
delimStyle: 'delim',
|
||
|
innerStyle: 'inner'
|
||
|
};
|
||
|
|
||
|
return CodeMirror.multiplexingMode(outer, innerOptions);
|
||
|
});
|
||
|
|
||
|
var mode = CodeMirror.getMode({}, "markdown_with_stex");
|
||
|
|
||
|
function MT(name) {
|
||
|
test.mode(
|
||
|
name,
|
||
|
mode,
|
||
|
Array.prototype.slice.call(arguments, 1),
|
||
|
'multiplexing');
|
||
|
}
|
||
|
|
||
|
MT(
|
||
|
"stexInsideMarkdown",
|
||
|
"[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
|
||
|
|
||
|
CodeMirror.defineMode("identical_delim_multiplex", function() {
|
||
|
return CodeMirror.multiplexingMode(CodeMirror.getMode({indentUnit: 2}, "javascript"), {
|
||
|
open: "#",
|
||
|
close: "#",
|
||
|
mode: CodeMirror.getMode({}, "markdown"),
|
||
|
parseDelimiters: true,
|
||
|
innerStyle: "q"
|
||
|
});
|
||
|
});
|
||
|
|
||
|
var mode2 = CodeMirror.getMode({}, "identical_delim_multiplex");
|
||
|
|
||
|
test.mode("identical_delimiters_with_parseDelimiters", mode2, [
|
||
|
"[keyword let] [def x] [operator =] [q #foo][q&em *bar*][q #];"
|
||
|
], "multiplexing")
|
||
|
})();
|