mixedmath

Explorations in math and programming
David Lowry-Duda



Today I announce MathShare, a very simple not-quite replacement for MathB.in.

Both are math pastebins, ways to share latex snippets with people. There are better ways to share long documents (e.g. a blog, a github, gists, etc). And there are better ways to collaborate (e.g. github or Overleaf or Dropbox or email). But sharing short notes, or writing just enough math to make a question clear to an audience that isn't used to reading latex in their head, is annoying.

I used MathB.in for that before. Now it's going away. So now I make MathShare.

Purely Client Side

Susam Pal, the creater of MathB.in, notes that MathB.in regularly caused headaches because regulatory authorities would detect some sort of submitted content that they cared about. Dealing with user-submitted content is a pain. There's not enough time to validate user generated content, and users are clever. Do you want to have a volunteer moderator corps? Oof, that sounds like a logistical nightmare.

So MathShare is a static math pastebin and runs entirely on the client side.

A user write up to $1500$ characters of markdown+latex and hits generate url on the page. The content is then base64-encoded into a data blob, and the url is this blob. Stated differently, the url itself is the data for the page. The character limit is caused by practical limits for URL parsing. There is no specified maximum length of a URL, but 2kb seems to be approximately correct in practice. Thus we restrict to $2000$ characters for the URL data blob, translating to $1500$ characters before base64 encryption.

How much can you write in one page?

If this sounds like something useful to you, great! Go check it out. Implicitly it works much better if whatever method you have of sharing the URL shortens the URL (e.g. if one can write markdown and do something like share [super-long-...-link](a note), or if one uses a URL shortener).1 1Fortunately this is often true for me in practice. And for notes that are long or meant to be semi-permanent, there are better ways of hosting them.

For the rest of this note, I want to talk about how I wrote this tool.

LLM Assisted Code Generation

LLMs generated most of the code for this project. I tried to have an LLM also generate the spec and prompts that I would later feed back to (maybe the same, maybe a different) LLM to actually write the code.

This worked really well, so I wanted to document it. I've done similar approaches before, but this work was motivated by this helpful post by Harper Reed.

Below I include the prompts and responses that led to this project.

Conversation

Prompt 1

Ask me one question at a time so we can develop a thorough, step-by-step spec for this idea. Each question should build on my previous answers and our end goal is to have a detailed specification I can hand off to a developer. Let's do this iteratively and dig into every relevant detail. Remember, only one question at a time.

We are going to be making a tool for mathematicians to share snippets of math. This is going to work by having a page where one can write markdown+mathjax in an online editor (with a preview on the side). There should be an "export" button at the bottom. What this will do is take the markdown, encode is in base64, and add URL parameters with this data. If another user goes to that URL (with those parameters), then the markdown box is populated with that content.

This prompt engineering aspect is taken verbatim from Harper Reed.

Great start! Let's begin by clarifying the core functionality.

**Question 1:**

Should the exported URL be permanent (i.e., saved on a server) or purely
client-side (i.e., encoded in the URL without any backend storage)?

This will determine whether we need a backend service or if we can rely
entirely on frontend logic.

Prompt 2

The exported URL should be purely client-side. The site itself can be static.

Got it! That simplifies deployment and eliminates the need for a backend.

**Question 2:**

How long should the encoded markdown be allowed to get? Base64 encoding
increases the size of the content, and long URLs might hit browser limits.
Should we set a practical character limit, or allow arbitrarily long
snippets?

PROMPT 3

We want to enforce a strict limit so that the generated URL has at most 2000 characters.

That makes sense for usability and compatibility. Since base64 encoding
increases size by about **33%**, we need to account for that.

For example:

*   If we allow **1500 characters of raw markdown**, base64 will expand it to ~2000 characters.
*   If we allow **1600 characters**, it will be ~2133 characters, exceeding our limit.

We’ll need to test the exact cutoff, but we can approximate it by allowing
**around 1500 characters** of raw markdown.

**Question 3:**
When the user exceeds this limit, should we:

1.  **Prevent further typing** (hard limit).
2.  **Show a warning but allow exceeding the limit until export** (soft limit).
3.  **Truncate automatically at export** (cutoff silently).

I was impressed at this aspect. Whenever I see an LLM produce anything numeric, I check to make sure that the numbers aren't completely nonsense. But they're correct here.

PROMPT 4

We should show a warning but allow exceeding the limit (a soft limit).

Great, so we’ll implement a **soft limit** with a warning when the user
exceeds the 1500-character mark, but they can keep typing.

**Question 4:**
How should the warning be displayed?

*   **Inline message** below the editor (e.g., “Warning: Your snippet may be
    too long to share via URL.”)
*   **Character counter** that changes color when exceeding the limit
*   **Modal popup** that appears when trying to export an oversized snippet
*   Something else?

PROMPT 5

A character counter, and an inline message that warns when the counter exceeds the limit.

Perfect! We'll have a **character counter** visible at all times, and when
the user exceeds 1500 characters, an **inline warning message** will appear
below the editor.

**Question 5:**
Should the counter show:

1.  **Characters used (e.g., "1540/1500")**, making it clear they’ve exceeded the limit.
2.  **Characters remaining (e.g., "Remaining: -40")**, which becomes negative when over the limit.
3.  **Only the total count** with color change (e.g., black when under, red when over).

I'm not accustomed to LLMs picking up this level of granularity.

PROMPT 6

Characters remaining.

Got it! The counter will display **characters remaining**, turning negative
when over the limit.

**Question 6:**
Should the inline warning message always be visible when over the limit, or
only appear when the user tries to export?

PROMPT 7

Always.

Great! The warning will **always be visible** when the character count goes
negative.

**Question 7:**
Should the warning text be fixed (e.g., “Warning: Your snippet may be too
long to share via URL.”) or dynamic (e.g., “Warning: Your snippet is 40
characters over the limit.”)?

PROMPT 8

Fixed

Understood! The warning will always say:
**“Warning: Your snippet may be too long to share via URL.”**

**Question 8:**
Should we allow users to manually shorten their text, or provide an automatic
“Trim to Fit” button that removes excess characters?

PROMPT 9

We should require users to manually shorted their text.

Got it! Users will need to manually shorten their text if it exceeds the limit.

**Question 9:**
Should we provide any formatting tools (e.g., bold, italic, equation
insertion buttons), or just a plain markdown editor with a preview?

PROMPT 10

We'll provide just a plain editor with preview.

> Great! It will be a straightforward **plain markdown editor** with a live
> preview.
>
> **Question 10:**
> How should the preview update? Should it update:
>
> 1.  **In real-time** as the user types.
> 2.  **On a specific action** (like clicking a button or losing focus on the editor).

PROMPT 11

It should update in real-time, starting rendering if the user hasn't typed for 2 seconds

> Excellent choice! The preview will update in **real-time**, but with a
> **2-second delay** after the user stops typing to optimize performance.
>
> **Question 11:**
> For the "Export" button, how should it be labeled? Should it simply say
> "Export," or would you prefer something more descriptive, like "Generate URL"
> or "Share Snippet"?

PROMPT 12

"Generate URL"

If this were completely automated, then this would be one thing. But really this is in the weeds.

> Got it! The button will be labeled **"Generate URL."**
>
> **Question 12:**
> After the URL is generated, should the tool:
>
> 1.  **Automatically copy the URL to the clipboard** and display a confirmation message.
> 2.  **Display the URL in a text box** for the user to copy manually.
> 3.  **Open the generated URL in a new tab** for the user.
> 4.  **Provide both options**?

PROMPT 13

Display the URL in a text box with a button beside it that says "copy to clipboard"

> Perfect! After generating the URL, it will be displayed in a text box with a
> **"Copy to Clipboard"** button next to it.
>
> **Question 13:**
> Should the tool include any functionality to handle potential errors (e.g.,
> if the URL fails to generate)? If so, what kind of error messages or feedback
> would you like to provide to the user?

PROMPT 14

No, let's keep the tool lean.

> Understood! We’ll keep the tool lean and avoid error handling for URL generation.
>
> **Question 14:**
> How should the overall layout be structured? For example:
>
> 1.  **Editor on the left, preview on the right**
> 2.  **Editor on top, preview below**
> 3.  **Split view with tabs** for switching between editor and preview
> 4.  Something else?

PROMPT 15

Editor on the left, preview on the right.

> Got it! The layout will have the **editor on the left** and the **preview on
> the right.**
>
> **Question 15:**
> Would you like to include any footer or header elements, such as a title for
> the page, a logo, or links to other resources? If so, what should they
> include?

PROMPT 16

Yes. The header should include the site name (which right now is "TEST SITE", an "About this site" link, and a "Source" link). The footer should include "Written by DLD", a year and a copyright notice, and a "Report Issue" link to a github.

> That sounds good! Just a couple of suggestions for clarity:
>
> 1.  **Year**: Make sure the year is dynamic so it always reflects the current year.
> 2.  **Copyright Notice**: Typically includes something like "© Year DLD. All rights reserved."
>
> With those in mind, here's a quick overview of the header and footer:
>
> *   **Header**: "TEST SITE", "About this site" link, "Source" link.
> *   **Footer**: "© Current Year DLD. All rights reserved", "Report Issue" link to GitHub.
>
> **Question 16:**
> Is there any specific styling or color scheme you'd like to use for the
> editor, preview, header, and footer, or should we keep it simple and default?

I'm convinced that color schemes should be done at the very end, and I was afraid to see what would happen if I set it off on some direction. But now I wish that I'd tried, just to see whether my fear was justified or not.

Next time!

PROMPT 17

Let's keep is simple and default for now.

> Got it! We'll keep the design **simple and default** for the editor, preview,
> header, and footer.
>
> **Question 17:**
> Finally, do you have any specific requirements for browser compatibility, or
> should we aim for the latest versions of major browsers (Chrome, Firefox,
> Safari, Edge)?

PROMPT 18

Let's just aim for latest versions.

> Understood! We'll aim for compatibility with the **latest versions of major
> browsers** (Chrome, Firefox, Safari, Edge).
>
> Here’s a quick summary of the specifications we’ve developed for your tool:
>
> ### Tool Specification for Sharing Math Snippets
>
> *   **Functionality**: Users can write markdown + MathJax in an online editor
>     with a live preview.
> *   **Editor Layout**: Editor on the left, preview on the right.
> *   **Character Limit**: 1500 characters for raw markdown with a soft limit
>     (warning displayed if exceeded).
> *   **Warning Display**: Fixed message: “Warning: Your snippet may be too
>     long to share via URL.” shown when exceeding the limit.
> *   **Character Counter**: Displays remaining characters, going negative when
>     over the limit.
> *   **Preview Update**: Updates in real-time with a 2-second delay after
>     typing stops.
> *   **Export Button**: Labeled "Generate URL," displays the generated URL in
>     a text box with a "Copy to Clipboard" button.
> *   **Header**: Includes "TEST SITE", "About this site" link, "Source" link.
> *   **Footer**: "© Current Year DLD. All rights reserved", "Report Issue"
>     link to GitHub.
> *   **Design**: Simple and default styling.
> *   **Browser Compatibility**: Aiming for the latest versions of major
>     browsers.
>
> Is there anything else you would like to add or modify in this specification?

PROMPT 19

Now that we've wrapped up the brainstorming process, can you compile our findings into a comprehensive, developer-ready specification? Include all relevant requirements, architecture choices, data handling details, error handling strategies, and an implementation plan so a developer can immediately begin implementation.

Sure! Here’s a comprehensive, developer-ready specification for the tool:

Specification for Math Snippet Sharing Tool
===========================================

Overview
——–

This tool allows mathematicians to create, preview, and share snippets of math
using markdown and MathJax. Users can generate URLs to share their snippets,
which are encoded in base64 format to ensure compatibility and ease of use.

Functional Requirements
———————–

### 1\. User Interface

*   **Layout**:

    *   The editor should be on the left side of the screen, and the live
        preview should be on the right.
    *   Include a header and footer.
*   **Header**:

    *   Displays "TEST SITE"
    *   Links: "About this site" and "Source"
*   **Footer**:

    *   Displays "©\[Current Year\] DLD. All rights reserved"
    *   Includes a "Report Issue" link to GitHub
*   **Editor**:

    *   A plain markdown input area where users can write and format their
        snippets.
    *   A character counter that displays remaining characters (with a maximum
        limit of 1500 characters).
    *   An inline warning message when the character count exceeds the limit.
*   **Preview**:

    *   Updates in real-time with a 2-second delay after the user stops typing.
    *   Renders markdown and MathJax content.

### 2\. URL Generation

*   **Export Button**: Labeled "Generate URL".
*   The generated URL should:
    *   Encode the markdown content in base64 format.
    *   Be displayed in a text box with a "Copy to Clipboard" button.
*   **Character Limit Enforcement**:
    *   A soft limit of 1500 characters for raw markdown input.
    *   Display a fixed warning message when the user exceeds the limit.

### 3\. Error Handling

*   The tool is designed to be lean and will not include error handling for URL
    generation.

Architecture Choices
——————–

*   **Frontend**: HTML, CSS, and JavaScript for a static site with no backend
    dependencies.
*   **Libraries**:
    *   Markdown parsing library for processing markdown input.
    *   MathJax for rendering mathematical expressions.

Data Handling
————-

*   **Character Limit**:
    *   The input will be validated in real-time to ensure it does not exceed
        1500 characters.
*   **Base64 Encoding**:
    *   Use JavaScript's built-in functions to encode the markdown content into
        base64 format before generating the URL.

Implementation Plan
——————-

1.  **Set Up the Project**:

    *   Create the static HTML structure with header, footer, editor, and
        preview sections.
2.  **Implement the Editor**:

    *   Create a textarea for the markdown input and display the character
        counter.
3.  **Implement the Preview**:

    *   Use MathJax to render the markdown and math expressions in the preview
        area.
4.  **Character Count Logic**:

    *   Implement the logic to count characters and display the warning message
        when exceeding the limit.
5.  **URL Generation**:

    *   Create the logic for encoding the markdown in base64 and generating the
        URL.
6.  **Copy to Clipboard Functionality**:

    *   Implement the button to copy the generated URL to the clipboard.
7.  **Styling**:

    *   Apply default styles for a clean and simple layout.
8.  **Testing**:

    *   Test the functionality across different browsers to ensure
        compatibility.
9.  **Deployment**:

    *   Host the static site on a web server or a static hosting service.

Browser Compatibility
———————

*   The tool will support the latest versions of major browsers: Chrome,
    Firefox, Safari, and Edge.

This specification provides a detailed outline of the tool's functionality,
design, and implementation steps for a developer to begin work immediately. Let
me know if there's anything you’d like to adjust or expand upon!

PROMPT 20

Draft a detailed, step-by-step blueprint for building this project. Then, once you have a solid plan, break it down into small, iterative chunks that build on each other. Look at these chunks and then go another round to break it into small steps. review the results and make sure that the steps are small enough to be implemented safely, but big enough to move the project forward. Iterate until you feel that the steps are right sized for this project.

From here you should have the foundation to provide a series of prompts for a code-generation LLM that will implement each step. Prioritize best practices, and incremental progress, ensuring no big jumps in complexity at any stage. Make sure that each prompt builds on the previous prompts, and ends with wiring things together. There should be no hanging or orphaned code that isn't integrated into a previous step.

Make sure and separate each prompt section. Use markdown. Each prompt should be tagged as text using code tags. The goal is to output prompts, but context, etc is important as well.

Here’s a detailed blueprint and an iterative breakdown for building the math
snippet sharing tool. Each step builds incrementally, focusing on best
practices and ensuring integration without orphaned code.

Step-by-Step Blueprint for Building the Project
———————————————–

### 1\. Project Setup

*   Create the project directory structure.
*   Initialize an HTML file for the main interface.
*   Set up a CSS file for styling.
*   Set up a JavaScript file for functionality.

### 2\. Build the HTML Structure

*   Implement the header with site name and links.
*   Create the main layout with an editor section and a preview section.
*   Add a footer with copyright information and a report issue link.

### 3\. Implement the Editor

*   Create a textarea for markdown input.
*   Add a character counter to display the remaining characters.
*   Implement inline warning messages for character limit exceedance.

### 4\. Implement the Preview Functionality

*   Integrate MathJax to render mathematical expressions in the preview section.
*   Add JavaScript logic to update the preview in real-time.

### 5\. Implement URL Generation

*   Create a button labeled "Generate URL."
*   Encode the markdown content in base64 format.
*   Display the generated URL in a text box with a "Copy to Clipboard" button.

### 6\. Styling and User Experience

*   Style the layout for a clean and simple appearance.
*   Ensure responsive design for different screen sizes.

### 7\. Testing and Debugging

*   Test the functionality across various browsers.
*   Debug any issues with markdown rendering or URL generation.

### 8\. Deployment

*   Prepare the project for deployment.
*   Choose a static hosting service and upload the project files.

* * *

Iterative Breakdown of Steps
—————————-

### Iteration 1: High-Level Chunks

1.  **Project Initialization**

    *   Set up directory structure and files.
2.  **HTML Layout Creation**

    *   Build the static structure of the page.
3.  **Implement Markdown Editor**

    *   Create the markdown input and character counter.
4.  **Preview Functionality**

    *   Implement real-time preview with MathJax.
5.  **URL Handling**

    *   Add URL generation and copying functionality.
6.  **Styling and Responsiveness**

    *   Apply styles and ensure responsiveness.
7.  **Testing and Debugging**

    *   Test and fix any issues.
8.  **Deployment Preparation**

    *   Prepare and deploy the project.

### Iteration 2: Detailed Steps

#### Step 1: Project Initialization

1.  Create a new directory for the project.
2.  Inside the directory, create the following files:
    *   `index.html`
    *   `styles.css`
    *   `script.js`

#### Step 2: HTML Layout Creation

1.  Open `index.html` and set up the basic HTML structure.
2.  Add the header section with the site name and links.
3.  Create a main section with two divs: one for the editor and one for the
    preview.
4.  Add a footer section with copyright information.

#### Step 3: Implement Markdown Editor

1.  In `index.html`, add a `<textarea>` for the markdown input in the editor
    section.
2.  Below the `<textarea>`, add a `<div>` for the character counter.
3.  Write JavaScript code in `script.js` to calculate and display remaining
    characters.

#### Step 4: Preview Functionality

1.  Integrate MathJax by adding its script in the header of `index.html`.
2.  In `script.js`, write the logic to update the preview section based on the
    content of the `<textarea>`.
3.  Set a 2-second delay for the preview update after the user stops typing.

#### Step 5: URL Handling

1.  In `index.html`, add a button labeled "Generate URL."
2.  Write JavaScript code to handle URL generation, encoding the markdown in
    base64 format.
3.  Display the generated URL in a text box below the button.
4.  Add a "Copy to Clipboard" button next to the URL.

#### Step 6: Styling and Responsiveness

1.  Open `styles.css` and style the header, footer, editor, and preview
    sections.
2.  Ensure the layout is responsive for different screen sizes using CSS media
    queries.

#### Step 7: Testing and Debugging

1.  Test the tool in the latest versions of major browsers.
2.  Debug any issues related to markdown rendering, character counting, or URL
    generation.

#### Step 8: Deployment Preparation

1.  Prepare the project files for deployment by ensuring all links are
    relative.
2.  Choose a static hosting service (e.g., GitHub Pages, Netlify).
3.  Upload the project files to the hosting service.


Prompts for Code Generation LLM
——————————-

### Prompt 1: Project Initialization

``Create a new directory structure for a math snippet sharing tool. Inside the
directory, create three files: `index.html`, `styles.css`, and `script.js`. Set
up a basic HTML document structure in `index.html`.``

### Prompt 2: HTML Layout Creation

``In the `index.html` file, add the following structure: - A header section
that contains the site name "TEST SITE", an "About this site" link, and a
"Source" link. - A main section with two divs: one for the editor (markdown
input) and one for the preview. - A footer section that contains "© [Current
Year] DLD. All rights reserved" and a "Report Issue" link to GitHub.``

### Prompt 3: Implement Markdown Editor

``In the `index.html`, add a `<textarea>` for the markdown input inside the
editor section. Below the `<textarea>`, add a `<div>` to display the character
counter. In `script.js`, write JavaScript code to calculate the remaining
characters based on the input and display this in the counter div.``

### Prompt 4: Preview Functionality

``Integrate MathJax in the `index.html` file by adding its script tag in the
header. In `script.js`, write logic that updates the preview section based on
the content of the `<textarea>`. Implement a 2-second delay for the preview
update after the user stops typing.``

### Prompt 5: URL Handling

``In the `index.html`, add a button labeled "Generate URL" below the character
counter. Write JavaScript code in `script.js` to handle URL generation by
encoding the markdown content in base64 format. Display the generated URL in a
text box below the button and add a "Copy to Clipboard" button next to it.``

### Prompt 6: Styling and Responsiveness

``Open the `styles.css` file and apply basic styles for the header, footer,
editor, and preview sections. Ensure the layout is responsive for different
screen sizes using CSS media queries.``

### Prompt 7: Testing and Debugging

`Test the functionality of the math snippet sharing tool in the latest versions
of major browsers (Chrome, Firefox, Safari, Edge). Debug any issues related to
markdown rendering, character counting, or URL generation that arise during
testing.`

### Prompt 8: Deployment Preparation

``Prepare the project for deployment by ensuring that all links in `index.html`
are relative. Choose a static hosting service (e.g., GitHub Pages, Netlify) and
upload the project files to the service.``


This approach ensures that each prompt builds incrementally on the previous
work, maintaining best practices and a clear path forward without large jumps
in complexity. Each step is small enough to implement safely while moving the
project forward effectively. Let me know if there's anything you would like
to modify or add!

At this point, I could have split this work across different tools. But I chose to stay with the same model.

PROMPT 21

We're going to follow the prompts you've previously given.

Create a new directory structure for a math snippet sharing tool. Inside the directory, create three files: index.html, styles.css, and script.js. Set up a basic HTML document structure in index.html.

Here's how to set up the directory structure and the basic HTML document in `index.html`.

### Step 1: Create the Directory Structure

1.  **Create a New Directory**:

    *   Name it `math-snippet-tool`.
2.  **Inside the Directory, Create the Following Files**:

    *   `index.html`
    *   `styles.css`
    *   `script.js`

### Step 2: Basic HTML Document Structure in `index.html`

Open `index.html` and add the following basic HTML structure:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TEST SITE</title>
    <link rel="stylesheet" href="styles.css">
    
    
</head>
<body>
    <header>
        <h1>TEST SITE</h1>
        <nav>
            <a href="#">About this site</a>
            <a href="#">Source</a>
        </nav>
    </header>
    <main>
        <div class="editor-container">
            <textarea id="markdownInput" placeholder="Type your markdown here..."></textarea>
            <div id="characterCount">2000 characters remaining.</div>
        </div>
        <div class="preview-container">
            <h2>Preview</h2>
            <div id="preview"></div>
        </div>
    </main>
    <footer>
        <p>Written by DLD &copy; <span id="currentYear"></span>. All rights reserved.</p>
        <a href="#">Report Issue</a>
    </footer>
    
</body>
</html>
You now have the basic directory structure and HTML document in place. Let me
know if you would like to proceed with the next steps!

PROMPT 22

In the index.html, add a <textarea> for the markdown input inside the editor section. Below the <textarea>, add a <div> to display the character counter. In script.js, write JavaScript code to calculate the remaining characters based on the input and display this in the counter div.

Here’s how to update the `index.html` file to include the `<textarea>` for
markdown input and a `<div>` for the character counter. I'll also provide the
necessary JavaScript code in `script.js` to calculate the remaining characters.

### Step 1: Update `index.html`

Make sure your `index.html` includes the following code for the editor section:

<main>
    <div class="editor-container">
        <textarea id="markdownInput" placeholder="Type your markdown here..."></textarea>
        <div id="characterCount">2000 characters remaining.</div>
    </div>
    <div class="preview-container">
        <h2>Preview</h2>
        <div id="preview"></div>
    </div>
</main>

This code creates a `<textarea>` for users to input their markdown and a
`<div>` that displays the character count below it.

### Step 2: Write JavaScript in `script.js`

Now, open `script.js` and add the following JavaScript code to calculate and
display the remaining characters:
document.addEventListener('DOMContentLoaded', () => {
    const markdownInput = document.getElementById('markdownInput');
    const characterCount = document.getElementById('characterCount');
    const maxChars = 2000;

    // Update character count based on input
    markdownInput.addEventListener('input', () => {
        const inputLength = markdownInput.value.length;
        const remainingChars = maxChars - inputLength;

        characterCount.textContent = `${remainingChars} characters remaining.`;

        // Change the color of the character count if it exceeds the limit
        if (remainingChars < 0) {
            characterCount.style.color = 'red';
        } else {
            characterCount.style.color = 'gray';
        }
    });
});

PROMPT 23

  1. Implement the Preview Functionality
  2. Integrate MathJax to render mathematical expressions in the preview section.
  3. Add JavaScript logic to update the preview in real-time.

And so on, continuing approximately like this.

The preview functionality was the first case where the returned code wasn't quite right. So the chat becomes slightly more complicated.

I don't try to teach the LLM what changes I make if they're not structural. Instead, I maintain different states and expectations. I expect most of my code to quickly fall out of the LLM's context window and I don't think it's worth contextual memory for this type of correction.

In total, I used 46 prompts to have the LLM write almost everything, including the prompts themselves for the LLM.


Leave a comment

Info on how to comment

To make a comment, please send an email using the button below. Your email address won't be shared (unless you include it in the body of your comment). If you don't want your real name to be used next to your comment, please specify the name you would like to use. If you want your name to link to a particular url, include that as well.

bold, italics, and plain text are allowed in comments. A reasonable subset of markdown is supported, including lists, links, and fenced code blocks. In addition, math can be formatted using $(inline math)$ or $$(your display equation)$$.

Please use plaintext email when commenting. See Plaintext Email and Comments on this site for more. Note also that comments are expected to be open, considerate, and respectful.

Comment via email