-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
121 lines (93 loc) · 4.05 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
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Math/Markdown Editor</title>
<link rel="stylesheet" href="lib/mathquill.css"/>
<link rel="stylesheet" href="custom.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-yFRtMMDnQtDRO8rLpMIKrtPCD5jdktao2TV19YiZYWMDkUR5GQZR/NOVTdquEx1j" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-9Nhn55MVVN0/4OFx7EE5kpFBPsEMZxKTCnA+4fqDmg12eCTqGi6+BB2LjY8brQxJ" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
<script src="custom.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.10/clipboard.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="lib/mathquill.js"></script>
<script src="lib/markdown.min.js"></script>
</head>
<body>
<div class="container">
<div class="grid">
<div class="grid-item md">
<h3>Markdown</h3>
<textarea id="text-input" oninput="this.editor.update()"></textarea>
</div>
<div class="grid-item mathedit">
<div class='md-preview'>
<h3>Markdown Preview</h3>
<div id="preview"></div>
</div>
<h3>Math Editor</h3>
<p>
LaTeX Math input:
<img alt="homepage demo" src="https://cloud.githubusercontent.com/assets/225809/15163580/1bc048c4-16be-11e6-98a6-de467d00cff1.gif" style="height:2.5em;max-width:30%;margin-bottom: -1.5em;margin-left:0.5em;">
<br><br>
<span id="math-field"></span>
</p>
<h4>LaTeX Code</h4>
<span id="latex"></span>
<button class="buttonClass" data-clipboard-target="#latex">
<img src="https://clipboardjs.com/assets/images/clippy.svg" alt="Copy" class='copy-img'>
</button>
<div class="latex-helper">
<h3>LaTeX Helper</h3>
<iframe src="https://www.tutorialspoint.com/latex_equation_editor.htm" frameborder="0"></iframe>
</div>
</div>
</div>
<div>
</div>
<div class="navbar">
<button id="showPreview">Preview</button>
<button id='latex-helper'>LaTeX Helper</button><br>
</div>
</div>
<script>
var mathFieldSpan = document.getElementById('math-field');
var latexSpan = document.getElementById('latex');
var MQ = MathQuill.getInterface(2); // for backcompat
var mathField = MQ.MathField(mathFieldSpan, {
spaceBehavesLikeTab: true, // configurable
handlers: {
edit: function() { // useful event handlers
latexSpan.textContent = mathField.latex(); // simple API
}
}
});
</script>
<script>
// Markdown editor
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) { return document.getElementById(id); };
new Editor($("text-input"), $("preview"));
</script>
<script>
// create a new instance of Clipboard plugin for the button element
// using the class selector: .buttonClass
var clipboard = new Clipboard('.buttonClass');
// when text is copied into clipboard use it
clipboard.on('success', function(e) {
$('#log').text('Text copied into clipboard is: <' + e.text + '>');
e.clearSelection();
});
</script>
</body>
</html>