- Notifications
You must be signed in to change notification settings - Fork 5k
/
Copy pathmultiplex.html
75 lines (67 loc) · 2.1 KB
/
multiplex.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<title>CodeMirror: Multiplexing Parser Demo</title>
<metacharset="utf-8"/>
<linkrel=stylesheethref="../doc/docs.css">
<linkrel="stylesheet" href="../lib/codemirror.css">
<scriptsrc="../lib/codemirror.js"></script>
<scriptsrc="../addon/mode/multiplex.js"></script>
<scriptsrc="../mode/xml/xml.js"></script>
<style>
.CodeMirror {border:1px solid black;}
.cm-delimit {color:#fa4;}
</style>
<divid=nav>
<ahref="https://codemirror.net/5"><h1>CodeMirror</h1><imgid=logosrc="../doc/logo.png"></a>
<ul>
<li><ahref="../index.html">Home</a>
<li><ahref="../doc/manual.html">Manual</a>
<li><ahref="https://github.com/codemirror/codemirror5">Code</a>
</ul>
<ul>
<li><aclass=activehref="#">Multiplexing Parser</a>
</ul>
</div>
<article>
<h2>Multiplexing Parser Demo</h2>
<form><textareaid="code" name="code">
<html>
<bodystyle="<<magic>>">
<h1><<thisisnot<html>></h1>
<<
multiline
nothtml
atall:&amp;<link/>
>>
<p>this is html again</p>
</body>
</html>
</textarea></form>
<script>
CodeMirror.defineMode("demo",function(config){
returnCodeMirror.multiplexingMode(
CodeMirror.getMode(config,"text/html"),
{open: "<<",close: ">>",
mode: CodeMirror.getMode(config,"text/plain"),
delimStyle: "delimit"}
// .. more multiplexed styles can follow here
);
});
vareditor=CodeMirror.fromTextArea(document.getElementById("code"),{
mode: "demo",
lineNumbers: true,
lineWrapping: true
});
</script>
<p>Demonstration of a multiplexing mode, which, at certain
boundary strings, switches to one or more inner modes. The out
(HTML) mode does not get fed the content of the <code><<
>></code> blocks. See
the <ahref="../doc/manual.html#addon_multiplex">manual</a> and
the <ahref="../addon/mode/multiplex.js">source</a> for more
information.</p>
<p>
<strong>Parsing/Highlighting Tests:</strong>
<ahref="../test/index.html#multiplexing_*">normal</a>,
<ahref="../test/index.html#verbose,multiplexing_*">verbose</a>.
</p>
</article>