-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.html
206 lines (182 loc) · 5.13 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
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Convert Google Doc to Markdown</title>
<!-- Include Source Sans because it's the default for Google Docs -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<style type="text/css">
* {
box-sizing: border-box;
}
html, body {
background: #eee;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
height: 100%;
margin: 0;
}
body {
display: flex;
flex-direction: column;
}
main {
display: flex;
flex: 1 1 auto;
flex-direction: row;
justify-content: space-between;
width: 100%;
padding: 1em 2em;
}
#app-header {
flex: 0 0 auto;
margin: 0;
padding: 1em 2em;
}
#app-header h1 {
margin: 0 0 0.5em;
padding: 0;
}
#settings {
font-size: 0.75rem;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-items: baseline;
gap: 1em;
}
#settings input,
#settings select {
font-size: inherit;
}
.input-field {
border: 1px solid #ccc;
font-size: 1em;
overflow: auto;
padding: 1em;
}
#input-area {
position: relative;
width: calc(50% - 1em);
}
.instructions {
font-size: 2em;
font-weight: bold;
opacity: 0.5;
padding: 0 1em;
position: absolute;
top: 1em;
left: 0;
right: 0;
text-align: center;
}
#input {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 1;
}
#output-area {
position: relative;
width: calc(50% - 1em);
}
#output {
background: transparent;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
white-space: pre-wrap;
}
#app-footer {
flex: 0 0 auto;
margin: 0;
padding: 0 2em 1em;
font-style: italic;
}
#button-container {
position: absolute;
right: 0;
top: 0;
z-index: 2;
}
/**
* Baseline Styling for Pasted Content
*
* Different browsers apply a variety of DOM and style normalizations to
* content when pasting into a contenteditable node. In some cases,
* normalizing against the built-in user agent or page styles will cause
* important formatting info to be lost entirely (e.g. bold text in
* headings). To prevent those issues, this applies some basic CSS resets
* to the input area.
*/
#input h1,
#input h2,
#input h3,
#input h4,
#input h5,
#input h6 {
font-weight: normal;
text-decoration: none;
}
/* Make bookmarks visible in the input area. */
#input a[id^="id."]:before,
#input a[name^="id."]:before {
content: "※ "
}
</style>
</head>
<body>
<header id="app-header">
<h1>Convert Google Docs to Markdown</h1>
<form id="settings">
<strong><span aria-hidden="true">⚙️</span> Settings:</strong>
<label>
Linkable Headings:
<select name="headingIds">
<option value="hidden">None</option>
<option value="html">Plain Markdown (HTML)</option>
<option value="extended">Extended Markdown</option>
</select>
</label>
<label>
Code Blocks:
<select name="codeBlocks">
<option value="indented">Indented</option>
<option value="fenced">Fenced (```)</option>
</select>
</label>
<label>
Suggested changes:
<select name="suggestions">
<option value="show">Show suggestions</option>
<option value="accept">Accept/use suggestions</option>
<option value="reject">Reject/ignore suggestions</option>
</select>
</label>
</form>
</header>
<main>
<div id="input-area">
<p class="instructions">Paste Google Docs text here…</p>
<div id="input" class="input-field" contenteditable autocomplete="off"></div>
</div>
<div id="output-area">
<div id="button-container">
<button id="download-button" style="display: none;">Download Markdown</button>
<button id="copy-button" style="display: none;">Copy Markdown</button>
</div>
<p class="instructions">…and get your Markdown here</p>
<textarea id="output" class="input-field" autocomplete="off"></textarea>
</div>
</main>
<footer id="app-footer">
<p>Source code available on <a href="https://github.com/mr0grog/google-docs-to-markdown" target="_blank" rel="noopener">Github</a>.</p>
</footer>
<script src="bundle.js"></script>
</body>
</html>