forked from BearToCode/carta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (64 loc) · 2.21 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Carta Markdown Editor: Browser Build Demo</title>
<link rel="stylesheet" href="../dist/full/carta.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" />
<!-- Fira font -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap" />
<style>
.carta-font-code,
.carta-font-code * {
font-family: 'Fira Code', monospace !important;
font-variant-ligatures: normal !important;
font-size: 1.1rem !important;
line-height: 1.5rem !important;
margin: 0px !important;
padding: 0px !important;
}
</style>
<script type="module">
import CartaMd from '../dist/full/carta-md.js'
import plugin_tikz from '../dist/full/plugin-tikz.js'
import plugin_math from '../dist/full/plugin-math.js'
import plugin_slash from '../dist/full/plugin-slash.js'
import plugin_emoji from '../dist/full/plugin-emoji.js'
import plugin_code from '../dist/full/plugin-code.js'
import plugin_anchor from '../dist/full/plugin-anchor.js'
import plugin_attachment from '../dist/full/plugin-attachment.js'
const init = (target) => {
const carta = new CartaMd.Carta({
extensions: [
plugin_tikz(),
plugin_math(),
plugin_slash(),
plugin_emoji(),
plugin_code(),
plugin_anchor(),
plugin_attachment({
supportedMimeTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/svg+xml'],
upload: async (file) => `https://beartocode.github.io/carta/${file.name}`
})
]
})
CartaMd.MarkdownEditor({
target,
carta,
context: []
})
}
document.addEventListener('DOMContentLoaded', (event) => {
init(
document.getElementById('root')
)
})
</script>
</head>
<body>
<div id="root"></div>
</body>
</html>