forked from tanakahisateru/js-markdown-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
251 lines (185 loc) · 4.38 KB
/
test.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>js-markdown-extra test</title>
<script src="js-markdown-extra.js"></script>
<style type="text/css">
#result table, #result th, #result td { border: 1px solid gray; }
#result pre, #result code { background: #EEE; }
#result blockquote { background: #FFE; font-style:italic; }
</style>
</head>
<body>
<div style="float:left; width:50%;">
<h1>Markdown</h1>
<pre id="mdtext" style="border:1px solid gray; margin:1em; padding:1em;">
Syntax Cheatsheet
========================================
PHRASE EMPHASIS
---------------
*italic* **bold**
_italic_ __bold__
this_text_is_normal
_this text_is italic_
LINKS
---------------
Inline:
An [example](http://url.com/ "Title")
Reference-style labels (titles are optional):
An [example][id] or [id]. Then, anywhere
else in the doc, define the link:
[id]: http://example.com/ "Title"
IMAGES
---------------
Inline (titles are optional):
![alt text](/path/img.jpg "Title")
Reference-style:
![alt text][imgid]
[imgid]: /url/to/img.jpg "Title"
HEADERS
---------------
Setext-style:
Header 1
========
Header 2 {#headers-1-2}
--------
atx-style (closing #'s are optional):
# Header 1 #
## Header 2 ## {#headers-2-2}
###### Header 6
LISTS
---------------
Ordered, without paragraphs:
1. Foo
2. Bar
Unordered, with paragraphs:
* A list item.
With multiple paragraphs.
* Bar
You can nest them:
* Abacus
* ass
* Bastard
1. bitch
2. bupkis
* BELITTLER
3. burper
* Cunning
BLOCKQUOTES
---------------
> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
>
> * You can quote a list.
> * Etc.
CODE SPANS
---------------
`<code>` spans are delimited
by backticks. `A` can be code.
You can include literal backticks
like `` `this` ``.
PREFORMATTED CODE BLOCKS
---------------
Indent every line of a code block by at least 4 spaces or 1 tab.
This is a normal paragraph.
This is a preformatted
code block.
Fenced code block enables writing code block without indent.
~~~~
This is also preformatted
code block.
~~~~
HORIZONTAL RULES
---------------
Three or more dashes or asterisks:
---
* * *
- - - -
MANUAL LINE BREAKS
---------------
End a line with two or more spaces:
Roses are red,
Violets are blue.
- - - - - - - - - - - - - - - - - - - -
Footnotes
---------------
This footnote will appear at the bottom of the document[^1].
The footnote doesn't have to be a number[^nonumber].
[^1]: Told you it'd be here at the bottom.
[^nonumber]: See, not a number.
Though it does appear as a number in the html's ordered list.
Table
-----------------
|a |b |c
|--|--|--
|1 |2 |3
or
a |b |c
--|--|--
1 |2 |3
alignment
rigt|left | center
-----:|:-----|:------:
0001 | 2 | 003
4 | 0005 | 6
Definition list
-----------------
term
: definithion
term
: definithion
is here
term
: definithion
can have multi paragraph
Auto link
-----------------
<http://foo.com/>
<mailto:foo@bar.com>
Encode
-----------------
& < "aaa" \`aaa\` \\
Inline HTML
-----------------
<p>
HTML is represented as is.<br>
<del>The <strong>quick brown fox</strong> jumps over the lazy dog.</del>
</p>
<div>
Regularly Markdown syntax ignored in HTML.<br/>
[Google](http://www.google.co.jp/)
</div>
<div markdown="1">
Markdow enabled inside HTML when marked by markdown="1" attribute.
[Google](http://www.google.co.jp/)
</div>
</pre>
</div>
<div style="float:right; width:50%;">
<h1>Html</h1>
<div id="result" style="border:1px solid gray; margin:1em; padding:1em;">
<script>
var mdtextElement = document.getElementById('mdtext');
var mdtext = mdtextElement.innerText ? mdtextElement.innerText : mdtextElement.textContent;
/*
document.write('<pre>' + mdtext
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>') + '</pre>');
document.write('<hr/>');*/
var html = Markdown(mdtext);
document.write('<pre>' + html
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>') + '</pre>');
document.write('<hr/>');
document.write(html);
</script>
</div>
</div>
<hr style="clear:both;" />
</body>
</html>