blob: 6cb610c4e4ed5bb9b3777d890327f2ef210bee72 (
plain) (
blame)
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
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>likha-pdf</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kj-sh604/noir.css@latest/out/noir.min.css" />
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
<style>
.htmx-indicator {
display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
display: inline;
}
</style>
</head>
<body>
<main>
<h1>likha-pdf</h1>
<p>simple markdown export with pandoc + lualatex.</p>
<form
id="convert-form"
hx-post="/convert"
hx-target="#result"
hx-swap="innerHTML"
hx-indicator="#loading"
>
<label for="markdown"><h3>textarea</h3></label>
<textarea
id="markdown"
name="markdown"
rows="16"
placeholder="markdown goes here..."
required
></textarea>
<section id="image-upload-section">
<label for="image"><small>image file</small></label>
<input id="image" name="image" type="file" accept="image/*" />
<button
id="upload-button"
type="button"
hx-post="/upload-image"
hx-target="#upload-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data"
hx-include="#image"
hx-indicator="#uploading"
>upload image</button>
<small id="uploading" class="htmx-indicator">uploading…</small>
<div id="upload-result" aria-live="polite"></div>
</section>
<section id="md-file-section">
<h3>or upload a markdown file</h3>
<label for="md-file"><small><em>(overrides textarea)</em></small></label>
<input id="md-file" type="file" accept=".md,.markdown,text/markdown,text/plain" />
</section>
<section>
<h3>pdf options</h3>
<label for="paper_size">Paper size</label>
<select id="paper_size" name="paper_size">
<option value="a4paper">A4</option>
<option value="letterpaper">US Letter</option>
<option value="legalpaper">US Legal</option>
</select>
<label for="margin">Margins</label>
<select id="margin" name="margin">
<option value="0.75in">Narrow (0.75in)</option>
<option value="1in" selected>Normal (1in)</option>
<option value="1.25in">Comfort (1.25in)</option>
<option value="1.5in">Wide (1.5in)</option>
</select>
<fieldset>
<legend>main font</legend>
<label>
<input type="radio" name="main_font" value="serif" checked /> serif
</label>
<label>
<input type="radio" name="main_font" value="sans" /> sans-serif
</label>
</fieldset>
<label for="line_spacing">Line spacing</label>
<select id="line_spacing" name="line_spacing">
<option value="1" selected>Single (1.0)</option>
<option value="1.5">One-and-a-half (1.5)</option>
<option value="2">Double (2.0)</option>
</select>
<label>
<input type="checkbox" name="page_numbers" value="on" checked /> show page numbers
</label>
</section>
<button id="convert-button" type="submit">generate pdf</button>
<small id="loading" class="htmx-indicator">converting…</small>
</form>
<section id="result" aria-live="polite"></section>
</main>
<script src="/static/main.js"></script>
</body>
</html>
|