1
1
---
2
- title : Preview
2
+ title : Article Preview
3
3
hide :
4
4
- navigation
5
5
---
@@ -11,25 +11,53 @@ hide:
11
11
var URL = " https://us-central1-cp-algorithms.cloudfunctions.net/convert-markdown-mkdocs" ;
12
12
var data = {" markdown" : markdown};
13
13
var refresh_script = ` <scr` + ` ipt>MathJax.typeset();</scr` + ` ipt>` ;
14
- $ (" #previewArea " ).html (" Loading..." );
14
+ $ (" #previewBtn " ).html (" Loading..." );
15
15
$ .ajax ({
16
16
url: URL ,
17
17
contentType: " application/json" ,
18
18
method: ' POST' ,
19
19
data: JSON .stringify (data),
20
- success : function (data ) { $ (" #previewArea" ).html (data + " \n " + refresh_script); },
20
+ success : function (data ) {
21
+ $ (" #previewArea" ).html (data + " \n " + refresh_script);
22
+ $ (" #previewBtn" ).html (" Preview (Ctrl + Enter)" );
23
+ },
21
24
error : function () {$ (" #previewArea" ).html (" Internal error!" )}
22
25
});
23
26
});
27
+
28
+ $ (' form' ).keydown (function (event ) {
29
+ if (event .ctrlKey && event .keyCode === 13 ) {
30
+ $ (" #previewBtn" ).click ();
31
+ }
32
+ })
24
33
});
25
34
</script >
26
- # Preview the rendering of your article
35
+ # Article Preview
27
36
37
+ <a href =" contrib.md " >Information for contributors</a >
38
+ <center >
28
39
<form >
29
- <textarea style =" width :90% ;height :400px ;" id =" markdownInput " placeholder =" paste your text here... " ></textarea >
40
+ <textarea style =" width :100% ;height :300px ;" id =" markdownInput " >
41
+ ---
42
+ title: Example article
43
+ hide:
44
+ - navigation
45
+ ---
46
+ # Example article
47
+
48
+ $$a^2 + b^2 = c^2$$
49
+
50
+ ```cpp
51
+ int gcd (int a, int b) {
52
+ if (b == 0)
53
+ return a;
54
+ else
55
+ return gcd (b, a % b);
56
+ }
57
+ ``` </textarea >
30
58
<br />
31
59
<br />
32
- <button type =' button ' class =" md-button md-button--primary " id =" previewBtn " >Preview</button >
60
+ <button type =' button ' class =" md-button md-button--primary " id =" previewBtn " >Preview (Ctrl + Enter) </button >
33
61
</form >
34
62
</center >
35
63
<hr />
0 commit comments