diff mrjunejune/src/tools/latex_editor/index.html @ 244:b8aa08503378

[tools] Add sandboxed online LaTeX editor Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Mon, 03 Aug 2026 16:56:25 -0700
parents
children 4f2b50bc78e7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mrjunejune/src/tools/latex_editor/index.html	Mon Aug 03 16:56:25 2026 -0700
@@ -0,0 +1,83 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    {{/parts/base_head.html}}
+    <title>LaTeX Editor - MrJuneJune</title>
+    <link rel="stylesheet" href="/tools/latex_editor/index.css" />
+    <script src="/tools/latex_editor/index.js" defer></script>
+  </head>
+  <body>
+    {{/parts/header.html}}
+    <main class="latex-page">
+      <div class="latex-heading">
+        <div>
+          <h1>Online LaTeX Editor</h1>
+          <p>Write LaTeX here. My server compiles it inside a locked-down sandbox and sends the PDF back to this preview.</p>
+        </div>
+        <div class="latex-actions">
+          <label class="auto-compile">
+            <input id="autoCompile" type="checkbox" checked />
+            Auto compile
+          </label>
+          <button id="resetButton" type="button" class="secondary">Reset</button>
+          <button id="compileButton" type="button">Compile PDF</button>
+          <a id="downloadButton" class="button-link disabled" aria-disabled="true">Download</a>
+        </div>
+      </div>
+
+      <p id="latexStatus" class="latex-status" role="status" aria-live="polite">
+        Preparing your first PDF...
+      </p>
+
+      <div class="latex-workspace">
+        <section class="latex-panel editor-panel" aria-labelledby="sourceHeading">
+          <div class="panel-heading">
+            <h2 id="sourceHeading">document.tex</h2>
+            <span id="sourceSize">0 / 65,536 bytes</span>
+          </div>
+          <textarea id="latexSource" spellcheck="false" autocomplete="off" aria-label="LaTeX source">\documentclass[11pt]{article}
+\usepackage[margin=1in]{geometry}
+\usepackage{amsmath}
+\usepackage{xcolor}
+
+\title{Hello from my server}
+\author{MrJuneJune}
+\date{\today}
+
+\begin{document}
+\maketitle
+
+This PDF was compiled by the custom C server behind this website.
+
+\[
+  e^{i\pi} + 1 = 0
+\]
+
+\textcolor{blue}{Edit this document and watch the preview update.}
+
+\end{document}
+</textarea>
+        </section>
+
+        <section class="latex-panel preview-panel" aria-labelledby="previewHeading">
+          <div class="panel-heading">
+            <h2 id="previewHeading">PDF preview</h2>
+            <span>Server rendered</span>
+          </div>
+          <iframe
+            id="pdfPreview"
+            title="Compiled LaTeX PDF preview"
+            src="about:blank"
+          ></iframe>
+          <pre id="latexDiagnostics" class="latex-diagnostics" hidden></pre>
+        </section>
+      </div>
+
+      <section class="latex-notes">
+        <h2>Limits</h2>
+        <p>Source is capped at 64 KiB and compilation at 8 seconds. Shell commands, network access, and reads outside the isolated TeX workspace are blocked.</p>
+      </section>
+    </main>
+    {{/parts/footer.html}}
+  </body>
+</html>