aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorkj_sh6042026-02-16 01:15:50 -0500
committerkj_sh6042026-02-16 01:15:50 -0500
commit94c6fdd12c8352f26df112f1c21592b020bb7c06 (patch)
treebd5c54f18aadf6e2a803b6103a210769ce179a70 /templates
feat: initial commit
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html77
-rw-r--r--templates/partials/error.html4
-rw-r--r--templates/partials/result.html5
3 files changed, 86 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..cd9c316
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,77 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Markdown to 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>markdown → pdf</h1>
+ <p>simple markdown export with pandoc + lualatex.</p>
+
+ <form
+ hx-post="/convert"
+ hx-target="#result"
+ hx-swap="innerHTML"
+ hx-indicator="#loading"
+ >
+ <label for="markdown">Markdown</label>
+ <textarea
+ id="markdown"
+ name="markdown"
+ rows="16"
+ placeholder="markdown goes here..."
+ required
+ ></textarea>
+
+ <section>
+ <h3>pdf options</h3>
+
+ <label for="paper_size">Paper size</label>
+ <select id="paper_size" name="paper_size">
+ {% for key, label in paper_sizes.items() %}
+ <option value="{{ key }}">{{ label }}</option>
+ {% endfor %}
+ </select>
+
+ <label for="margin">Margins</label>
+ <select id="margin" name="margin">
+ {% for key, label in margins.items() %}
+ <option value="{{ key }}" {% if key == "1in" %}selected{% endif %}>{{ label }}</option>
+ {% endfor %}
+ </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>
+ </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="{{ url_for('static', filename='main.js') }}"></script>
+ </body>
+</html>
diff --git a/templates/partials/error.html b/templates/partials/error.html
new file mode 100644
index 0000000..83825f1
--- /dev/null
+++ b/templates/partials/error.html
@@ -0,0 +1,4 @@
+<article>
+ <h3>Conversion failed</h3>
+ <pre>{{ message }}</pre>
+</article>
diff --git a/templates/partials/result.html b/templates/partials/result.html
new file mode 100644
index 0000000..427382d
--- /dev/null
+++ b/templates/partials/result.html
@@ -0,0 +1,5 @@
+<article>
+ <h3>pdf ready</h3>
+ <p><strong>{{ filename }}</strong></p>
+ <a href="{{ download_url }}">download pdf</a>
+</article>