← Projects

Glyph

Edit and publish Markdown & mathematical notes.

Next.js / TypeScript / Clerk / Convex
Glyph’s public reader showing a mechanics note with mathematical equations
The public example reader, captured from the application. Select the image to enlarge.

Private work, public notes

I wanted a way to prepare Markdown and mathematical notes privately, then share a readable version when it was ready. Glyph keeps editing and publishing connected without making every saved draft public.

The project has involved reviewing the editing workflow, configuring authentication and testing who can retrieve a note, as well as working on the implementation.

Glyph

Markdown, maths
and a link to share.

Write a private draft Edit & preview Publish at your own URL

Unpublish to withdraw public access.

Editing & preview

Create a note in the BlockNote editor or import a Markdown or LaTeX file. Notes support headings, lists, code and mathematical notation, with a preview of the rendered document before publishing.

The reader includes heading navigation, code copying and print styles. LaTeX imports convert supported text and equations into Markdown; unsupported commands remain as source with a conversion notice.

Implementation

Next.js renders notes using remark, rehype and KaTeX. Clerk handles sign-in, and Convex stores note metadata and source files. Private drafts are retrieved for the signed-in owner.

const ownerId = await requireOwner(ctx);
const noteId = ctx.db.normalizeId('notes', id);
const note = noteId ? await ctx.db.get('notes', noteId) : null;
return note?.ownerId === ownerId ? note : null;
Read the ownership check ↗

Handling content safely

A sign-in screen alone does not protect a draft. Convex checks the verified user against the note’s owner when reading or changing private content. Public metadata and source reads separately require the note to be published.

Uploads are checked for supported text formats, valid UTF-8 and size before storage. Rendering discards raw HTML and sanitises the Markdown tree before KaTeX adds maths markup, with trusted commands disabled and expansion limits applied.

LaTeX conversion is deliberately limited: it converts supported content without executing a TeX engine, loading packages or fetching external files. Preserving unsupported source with a notice is more useful than silently losing it.

Publishing

Choose a custom URL when publishing a note. Published notes must be unpublished before editing, so saving a draft does not change the live document. Unpublishing also removes public access to the note.

The source is read through access-checked actions rather than a permanent public storage URL. Unpublishing blocks subsequent public requests, although it cannot recall content someone has already downloaded.

The test suite covers note access, file uploads, rendering and publication, including unpublishing and deleting notes.

View tests ↗

Challenges & learning

The main design problem is keeping publication separate from ordinary saving, including when another tab has an older copy open. Draft saves check the note’s revision and reject conflicting updates; published notes must be unpublished before editing.

Working on those boundaries has helped me distinguish authentication, ownership and public access. Tests for another user’s note, unpublished content and malicious markup make those rules more concrete than simply describing a page as private.

Next project Personal Portfolio