-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
359 lines (275 loc) · 8.8 KB
/
Copy pathindex.html
File metadata and controls
359 lines (275 loc) · 8.8 KB
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>mathjax extension sample</title>
<link href="https://cdn.jsdelivr.net/npm/prismjs@9000.0.1/themes/prism.min.css" rel="stylesheet">
<style>
body {
margin: 1em 50px;
}
/*锚点样式*/
h1:hover .octicon, h2:hover .octicon, h3:hover .octicon, h4:hover .octicon, h5:hover .octicon, h6:hover .octicon {
visibility: visible;
}
.anchor {
float: left;
line-height: 1;
margin-left: -20px;
padding-right: 4px;
}
.anchor:focus .octicon {
visibility: visible;
}
.octicon {
display: inline-block;
fill: currentColor;
color: #1b1f23;
vertical-align: middle;
visibility: hidden;
}
/* 目录样式 */
.cat ul {
list-style-type: none;
-webkit-margin-before: 0em;
-webkit-margin-after: 0em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
-webkit-padding-start: 0px;
}
.cat ul ul {
list-style-type: none;
-webkit-margin-before: 0em;
-webkit-margin-after: 0em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
-webkit-padding-start: 40px;
}
.cat li, li {
padding-top: 0em;
padding-bottom: 0em;
margin-top: 0;
margin-bottom: 0;
}
</style>
</head>
<body>
<div id="content"></div>
<textarea id="markdownText" hidden>
# showdown-extensions
An extension in showdown documents using markdown syntax
[Sample](http://excing.github.io/sample/extensions_sample.html)
- what is showdown
Showdown is a Javascript Markdown to HTML converter, based on the original works by John Gruber. Showdown can be used client side (in the browser) or server side (with NodeJs).
Check a live Demo here [http://demo.showdownjs.com/](http://demo.showdownjs.com/)
Click [showdown github](https://github.com/showdownjs/showdown)
- what is showdown extensions
Showdown allows additional functionality to be loaded via extensions
see [showdown extensions wiki](https://github.com/showdownjs/showdown/wiki/extensions)
## Usage
```java
var markdown = `# showdown-extensions`;
var converter = new showdown.Converter({extensions: ['exension-name_1', 'exension-name_2']}),
html = converter.makeHtml(markdown);
console.log(html);
```
## [showdoan-full-extensions.js](https://github.com/excing/showdown-extensions/blob/master/showdoan-full-extensions.js)
It contains all extensions, and rendering the subsequent operation has been completed.
you will need:
1. [showdown](https://github.com/showdownjs/showdown)
2. [prismjs](https://github.com/PrismJS/prism)
3. [raphael](https://github.com/DmitryBaranovskiy/raphael)
4. [underscore](https://github.com/jashkenas/underscore)
5. [js-sequence-diagrams](https://github.com/bramp/js-sequence-diagrams)
6. [flowchart.js](https://github.com/adrai/flowchart.js)
7. [MathJax](https://github.com/mathjax/MathJax)
recommend cdn:
1. [jsdelivr](https://www.jsdelivr.com/)
2. [cdnjs](https://cdnjs.com/):
recommend version:
- showdown: 1.5.0
- prismjs: 9000.0.1 (from jsdelivr cdn)
- raphael: 2.2.7
- underscore: 1.9.1
- js-sequence-diagrams: 1000000.0.6 (from jsdelivr cdn, this version can use the `raphael` library)
- flowchart.js: 1.11.3
- MathJax: 2.7.5
## extension list
### mathjax ([mathjax-extension.js](https://github.com/excing/showdown-extensions/blob/master/mathjax-extension.js))
Support for writing math formulas using `LaTex` syntax, then you can use the [Mathjax](https://github.com/mathjax/MathJax) plugin to display math formulas in web pages.
#### Markdown syntax
Please use `$` and `$$` to edit.
- Edit in a single line
```
The square area formula is: $S=a^2$.
```
- Multi-line editing
```
$$
\begin{alignat*}{2}
x& = y_1-y_2+y_3-y_5+y_8-\dots
&\quad& \\
& = y’\circ y^* && \\
& = y(0) y’ &&
\end{alignat*}
$$
```
#### Example
single line:
The square area formula is: $S=a^2$.
multi-line:
$$
\begin{alignat*}{2}
x& = y_1-y_2+y_3-y_5+y_8-\dots
&\quad& \\
& = y’\circ y^* && \\
& = y(0) y’ &&
\end{alignat*}
$$
### diagrams ([diagrams-extension.js](https://github.com/excing/showdown-extensions/blob/master/diagrams-extension.js))
Support for text format sequence diagrams and flowcharts, then you can use the [js-sequence-diagrams](https://github.com/bramp/js-sequence-diagrams) and [flowchart.js](https://github.com/adrai/flowchart.js) to display them.
#### Markdown syntax
use ` ```seq` and ` ```flow` to edit.
- sequence diagrams
```
Title: Here is a title
A->B: Normal line
B-->C: Dashed line
C-->C: Point to self
C->>D: Open arrow
D-->>A: Dashed open arrow
```
- flowchart
```
st=>start: Start:>http://www.google.com[blank]
e=>end:>http://www.google.com
op1=>operation: My Operation
sub1=>subroutine: My Subroutine
cond=>condition: Yes
or No?:>http://www.google.com
io=>inputoutput: catch something...
para=>parallel: parallel tasks
st->op1->cond
cond(yes)->io->e
cond(no)->para
para(path1, bottom)->sub1(right)->op1
para(path2, top)->op1
```
#### Example
sequence diagrams
```seq
Title: Here is a title
A->B: Normal line
B-->C: Dashed line
C-->C: Point to self
C->>D: Open arrow
D-->>A: Dashed open arrow
```
flowchart
```flow
st=>start: Start:>http://www.google.com[blank]
e=>end:>http://www.google.com
op1=>operation: My Operation
sub1=>subroutine: My Subroutine
cond=>condition: Yes
or No?:>http://www.google.com
io=>inputoutput: catch something...
para=>parallel: parallel tasks
st->op1->cond
cond(yes)->io->e
cond(no)->para
para(path1, bottom)->sub1(right)->op1
para(path2, top)->op1
```
### video ([video-extension.js](https://github.com/excing/showdown-extensions/blob/master/video-extension.js))
Support for the syntax of video display.
#### Markdown syntax
Simple:
```

```
Whole:
```

```
You can also use units:
```
=100x80 simple, assumes units are in px
=100x* sets the height to "auto"
=80%x5em width of 80% and height of 5em
```
#### Example

#### Support video format
- video/webm
- video/mp4
- video/ogg
### catalog ([catalog-extension.js](https://github.com/excing/showdown-extensions/blob/master/catalog-extension.js))
Support `<h1>` to `<h6>` catalog display.
#### Markdown syntax
A separate row: `[TOC]`
#### Example
[TOC]
### audio ([audio-extension.js](https://github.com/excing/showdown-extensions/blob/master/audio-extension.js))
Support for the syntax of audio display.
#### Markdown syntax
```

```
#### Example

#### Support video format
- audio/mpeg
- audio/wav
- audio/ogg
### anchor
Support for anchor buttons for `<h1>` to `<h6>` titles, the anchor style is GitHub anchor style.
#### Markdown syntax
Adapted directly `<h1>` to `<h6>` tag
</textarea>
<script src="https://cdn.jsdelivr.net/combine/npm/prismjs@9000.0.1,npm/prismjs@9000.0.1/components/prism-java.min.js,npm/prismjs@9000.0.1/components/prism-javascript.min.js,npm/prismjs@9000.0.1/components/prism-go.min.js,npm/prismjs@9000.0.1/components/prism-powershell.min.js,npm/prismjs@9000.0.1/components/prism-python.min.js,npm/prismjs@9000.0.1/components/prism-sql.min.js" ></script>
<script src="https://cdn.jsdelivr.net/combine/npm/showdown@1.5.0,npm/raphael@2.2.7,npm/underscore@1.9.1,npm/js-sequence-diagrams@1000000.0.6"></script>
<script src="https://cdn.jsdelivr.net/gh/adrai/flowchart.js@v1.11.3/release/flowchart.min.js"></script>
<script src="./showdown-full-extensions.js"></script>
<!-- <script src="./catalog-extension.js"></script>
<script src="./diagrams-extension.js"></script>
<script src="./mathjax-extension.js"></script>
<script src="./video-extension.js"></script>
<script src="./audio-extension.js"></script>
<script src="./anchor-extension.js"></script>
-->
<script src="./inner-markdown.js"></script>
<script>
var markdownTextArea = document.getElementById('markdownText');
var contentDiv = document.getElementById('content');
try {
innerMarkdownToContainer(contentDiv, markdownTextArea.textContent, ['mathjax', 'diagrams', 'video', 'audio', 'catalog', 'anchor']);
} catch (excp) {
contentDiv.innerHTML = excp
}
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
</body>
</html>