-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
executable file
·119 lines (116 loc) · 4.56 KB
/
demo.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<title>{{title}}</title>
<link rel="stylesheet" type="text/css" href="asset/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="asset/mermaid.css">
<link type="text/css" rel="stylesheet" href="asset/style.css">
<script type="text/javascript" src="asset/jquery_plantuml/jquery.js"></script>
<script type="text/javascript" src="asset/jquery_plantuml/rawdeflate.js"></script>
<script type="text/javascript" src="asset/jquery_plantuml/encode64.js"></script>
<script src="asset/echarts.common.min.js"></script>
<script src="asset/mermaid.min.js"></script>
<script src="bower_components/viz.js/viz.js"></script>
<script type="text/javascript">
$(function(){
var mwebii=0;
var mwebChartEleId = 'mweb-chart-ele-';
$('pre>code').each(function(){
mwebii++;
var eleiid = mwebChartEleId+mwebii;
if($(this).hasClass('language-mermaid')){
var ele = $(this).addClass('nohighlight').parent();
ele.hide();
$('<div id="'+eleiid+'"></div>').addClass('mermaid').html($(this).text()).insertAfter(ele);
}else if($(this).hasClass('language-plantuml')){
var ele = $(this).addClass('nohighlight').parent();
ele.hide();
var str = unescape(encodeURIComponent($(this).text()));
var imgURL = "http://www.plantuml.com/plantuml/svg/"+encode64(deflate(str,9));
var newEle = $('<div id="'+eleiid+'"><img src="'+imgURL+'" /></div>').insertAfter(ele);
}else if($(this).hasClass('language-js-echarts')){
var ele = $(this).addClass('nohighlight').parent();
ele.hide();
$('<div style="width: 100%;height:400px;" id="'+eleiid+'"></div>').insertAfter(ele);
var myChart = echarts.init(document.getElementById(eleiid));
try {
eval($(this).text());
myChart.setOption(option);
}catch(exception) {}
} else if($(this).hasClass('language-viz')){
var ele = $(this).addClass('nohighlight').parent();
ele.hide();
var str = unescape(encodeURIComponent($(this).text()));
var graph = Viz(str);
$('<div style="width: 100%;height:400px;" id="'+eleiid+'"></div>').html(graph).insertAfter(ele);
}
});
mermaid.init({noteMargin: 10}, ".mermaid");
});
</script>
</head>
<body>
<div class="markdown-body">
<pre><code class="language-viz">
digraph { a -> b ->c; }
</code></pre>
<pre><code class="language-mermaid">graph TD
B["fa:fa-twitter for peace"]
B-->C[fa:fa-ban forbidden]
B-->D(fa:fa-spinner);
B-->E(A fa:fa-camera-retro perhaps?);
</code></pre>
<pre><code class="language-plantuml">actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database
</code></pre>
<pre><code class="language-js-echarts">option = {
title : {
text: '某站点用户访问来源',
subtext: '纯属虚构',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
},
series : [
{
name: '访问来源',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:[
{value:335, name:'直接访问'},
{value:310, name:'邮件营销'},
{value:234, name:'联盟广告'},
{value:135, name:'视频广告'},
{value:1548, name:'搜索引擎'}
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
</code></pre>
</div>
</body>
</html>