本文整理汇总了TypeScript中codemirror.multiplexingMode函数的典型用法代码示例。如果您正苦于以下问题:TypeScript multiplexingMode函数的具体用法?TypeScript multiplexingMode怎么用?TypeScript multiplexingMode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了multiplexingMode函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
CodeMirror.defineMode('ipythongfm', (config: CodeMirror.EditorConfiguration, modeOptions?: any) => {
let gfmMode = CodeMirror.getMode(config, 'gfm');
let texMode = CodeMirror.getMode(config, 'stex');
return CodeMirror.multiplexingMode(
gfmMode,
{
open: '$$', close: '$$',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '$', close: '$',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '\\(', close: '\\)',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '\\[', close: '\\]',
mode: texMode,
delimStyle: 'delimit'
}
// .. more multiplexed styles can follow here
);
}, 'gfm');
示例2:
CodeMirror.defineMode("ihaskell", (config) => {
let hmode = CodeMirror.getMode(config, "haskell");
return CodeMirror.multiplexingMode(
hmode,
{
open: /:(?=!)/, // Matches : followed by !, but doesn't consume !
close: /^(?!!)/, // Matches start of line not followed by !, doesn't consume character
mode: CodeMirror.getMode(config, "text/plain"),
delimStyle: "delimit"
},
{
open: /\[r\||\[rprint\||\[rgraph\|/,
close: /\|\]/ ,
mode: CodeMirror.getMode(config, "text/x-rsrc"),
delimStyle: "delimit"}
);
});
示例3:
(config: CodeMirror.EditorConfiguration, modeOptions?: any) => {
let gfmMode = CodeMirror.getMode(config, {
name: 'gfm',
// Override list3 with an under-used token, rather than `keyword`
tokenTypeOverrides: { list3: 'string-2' }
});
let texMode = CodeMirror.getMode(config, {
name: 'stex',
inMathMode: true
});
return CodeMirror.multiplexingMode(
gfmMode,
{
open: '$$',
close: '$$',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '$',
close: '$',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '\\(',
close: '\\)',
mode: texMode,
delimStyle: 'delimit'
},
{
open: '\\[',
close: '\\]',
mode: texMode,
delimStyle: 'delimit'
}
// .. more multiplexed styles can follow here
);
},