-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
118 lines (116 loc) · 2.78 KB
/
index.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
<html>
<head>
<title>jQuery.Colorfy</title>
<style type='text/css'>
body {
text-align: center;
}
.input {
float: auto;
margin-left: auto;
margin-right: auto;
padding-left: 8px;
padding-right: 8px;
padding-top: 3px;
width: 600px;
height: 32px;
max-width: 600px;
border-color: black;
border-width: 2px;
border-style: solid;
font-size: 20px;
text-align: left;
outline: none;
}
.area {
float: auto;
margin-left: auto;
margin-right: auto;
padding: 8px;
width: 600px;
max-width: 600px;
height: 400px;
border-color: black;
border-width: 2px;
border-style: solid;
font-size: 15px;
text-align: left;
outline: none;
}
.money .currency {
color: red;
}
.money .number {
color: green;
}
.markdown .title {
color: red;
}
.markdown .block {
color: green;
}
.markdown .strong {
color: blue;
}
.markdown .emphasis {
color: pink;
}
.markdown .strikethrough {
color: lime;
}
.markdown .inlinecode {
color: purple;
}
.markdown .codeblock {
color: #CC0066;
}
.markdown .orderedlist {
color: maroon;
}
.markdown .unorderedlist {
color: silver;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="jquery.colorfy.js"></script>
<script type="text/javascript" src="jquery.colorfy.markdown.js"></script>
<script type="text/javascript">
$.fn.colorfy.money = {
"currency": /\$/m,
"number": /[0-9.]+/m
};
</script>
</head>
<body>
<h1>jQuery Colorfy</h1>
<p>Please write some markdown and try for yourself!</p>
<p>It works on newest Safari and Chrome!</p>
<p><strong>textarea example</strong></p>
<textarea id="area" class="area">
Please try for your self
# This is title
> This is inline block
Some text should be **strong**, some text should be _italic_
Some text should be ~~stroke through~~
- list
- list, too
1. ordered list
2. ordered list, too
You can customize the style through a very simple `css` like this
``` css
.markdown .orderedlist {
color: maroon;
}
.markdown .unorderedlist {
color: silver;
}
```</textarea>
<p><strong>input example</strong></p>
<input id="input" class="input" value="price $9.99"></input>
<p><a href="https://github.com/cheunghy/jquery.colorfy">Fork me on github</a></p>
<script type="text/javascript">
$('#area').colorfy("markdown");
$('#input').colorfy("money");
</script>
</body>
</html>