← ALL DEVLOGS
Devlog 2026-09-15

TTRPG Toolkit: Devlog #9 - My Tabletop RPG App Making Adventure Part 9

Loremaster looked at the vault and showed it back to me, and if I wanted to change a single word I still had to leave, open Obsidian, find the file, fix it, and come back. Part 3 is where that stopped being true.

Hello everyone

Loremaster - Part 3 of 3: The Writing Desk

Part 1 made the vault visible. Part 2 turned it into a screen I could run a session from. Both parts had one thing in common that I never quite said out loud: they only ever read my notes. Loremaster looked at the vault and showed it back to me, and if I wanted to change a single word I still had to leave, open Obsidian, find the file, fix it, and come back.

Part 3 is where that stopped being true.

Breaking my own rule

Part 1 had a line I was proud of: "read-mostly by design." The vault stays the source of truth, Loremaster just displays it. That was the right call for a browser. It turned out to be the wrong call the moment I was mid-prep, reading a location dossier, and spotted a typo I couldn't fix without breaking flow. The exact context-switch problem I spent all of Part 2 killing for reading was still sitting there for writing.

So Part 3 gives Loremaster an editor. Not a replacement for Obsidian's writing experience, Obsidian is genuinely great at that, but enough that I never have to leave the window to fix a line, add a scene, or spin up a new NPC note in the middle of a session.

Two panes, three views

Edit Mode is a workspace, not a text box. Left side is the vault: a file tree with a filter box, new-file and new-folder buttons, and drag-and-drop to move notes between folders. Right side is the editor: a rename field, a Save button (Ctrl+S works too), and a three-way toggle for how you want to see the note.

  • Edit is just the raw markdown, full width.
  • Preview is the rendered dossier, full width.
  • Split puts them side by side with the preview updating as you type.

The important detail is that the preview is not a second renderer. It calls the exact same markdown pipeline the dossiers use, so what you see while editing is what the note will look like everywhere else in the app. One renderer, one source of truth. If a table or a wikilink or a header pill looks right in Split, it looks right in the dossier, because it is the dossier.

A net under everything

Here is the thing about pointing an editor at my actual campaign vault: it is terrifying. Forty-plus locations, a full pantheon, years of session notes. One bad save that silently truncates a file and I would not forgive myself. I am not brave enough to edit my own vault without a net, so I built the net first.

  • Every save is a git commit. Loremaster commits the file on write, with a message noting which note changed. If a save ever goes wrong, the previous version is one command away, and there is an in-app undo that walks it back.
  • Deletes go to a trash folder, not oblivion. Removing a note moves it into a .trash folder inside the vault. Recoverable. Nothing is actually destroyed by a click.
  • Path traversal is blocked. The vault editor cannot be tricked into reading or writing outside the vault with .. tricks.

None of this is visible when things go well, which is the point. It is the seatbelt you forget you are wearing. But it is the reason I trust the editor with the real thing instead of a copy.

Meeting the vault where it lives

The old way to tell Loremaster which vault to use was an environment variable in the terminal. Fine for me, awful as a workflow. So the app now asks the operating system directly. There is a native folder picker for choosing your vault, and a change-vault control so you can point it somewhere new without touching the command line. Set once, remembered after.

There is also a standalone editor window, a bare single-pane version with a native file picker that can open any .md on disk by its real path, edit it, and save it back. It is the "I just need to fix this one file" tool, decoupled from the whole dashboard.

And moving notes around is drag-and-drop now. Drop a file on a folder to move it inside, drop it on the tree background to send it to the root. The move goes through the same safe rename path, so it commits like any other change.

Coloring the raw text

This is the feature I most wanted and least expected to be hard.

I write session notes with deep structure, Scene inside Beat inside Aside, and in the rendered view those headings become the color-coded pills from Part 1. I wanted the raw editor to echo that: header lines tinted by level so I can see the shape of a note while I am writing it, H1 gold, H2 rose, H3 periwinkle, and down the scale. Color only. Not size. The text stays monospace and uniform so editing feels like editing, the color is just a quiet map of the outline.

The trick is that a plain textarea cannot color individual lines. So the editor is now two layers stacked exactly on top of each other: a transparent textarea you actually type into, and behind it a highlight layer that paints the same text with the header colors. The textarea handles all the real editing behavior, undo, selection, autocomplete, and the layer underneath just supplies the color. You are typing on glass over a colored page.

Folding while you write

Once the header lines were colored, folding them was the obvious next step. Preview headers already collapse. The raw editor headers do too now, with a fold arrow in the gutter next to each one. Click it and the section collapses down to just its heading, exactly like the preview, nested subsections folding away with their parent.

The part I care about is what happens underneath. Folding never actually removes text from the note. The editor keeps the complete document as the source of truth at all times and only shows you a collapsed view. Save while folded and the whole note is written, every hidden line intact. Fold is a reading aid, never a way to lose a paragraph. For a tool aimed at my own campaign vault, that guarantee was non-negotiable.

The wrong-line bug

Every devlog needs one honest war story. Here is this one's.

I shipped the colored editor, started using it, and within a day it was editing the wrong line. I would click on a word, start typing, and the change would land a line or two below where my cursor visibly was. Maddening, and exactly the kind of bug that makes you not trust an editor at all.

The cause was the two-layer trick turning against me. The colored layer behind and the textarea in front have to wrap long lines at precisely the same width, or the text on one drifts out of step with the text on the other. And the moment a note got long enough to need a scrollbar, the textarea's typing area lost about fifteen pixels to that scrollbar and started wrapping its lines earlier than the colored layer behind it. Everything below the first wrapped line slid down by a row. What I saw was the colored layer. Where my cursor actually was, was the textarea. They no longer agreed.

The fix was to make the colored layer reserve the exact same slice of width the scrollbar takes, so both layers wrap in perfect lockstep whether the scrollbar is there or not. It recalculates on every edit and on window resize, and it correctly handles the case where there is no scrollbar, and the Mac case where scrollbars float over the content and take no width at all.

While I was in there I hardened the folding too, so that clicking or typing inside a collapsed note maps your cursor back to the true line in the full text before it expands. Mouse, keyboard, and paste all land where you meant them to.

Lesson, filed next to Part 1's "build against real frontmatter": never assume two elements that show the same text will lay it out the same way. A scrollbar is fifteen pixels of chaos.

Predicting links

Small feature, constant payoff. Type [[ in the editor and a little menu appears predicting note names as you go, filtering as you type. Arrow keys or the mouse to choose, Enter to accept. Picking one drops in the name and closes the brackets for you, so a link is a few keystrokes instead of remembering and spelling out a note title. It floats above everything so it never gets clipped by the editor pane, and it flips upward when you are near the bottom of the screen.

Tables that behave

With an editor in the window, the gaps in how notes rendered got a lot more obvious, because now I was staring at the raw and the rendered side by side. Tables were the first thing to fix, in two ways.

Parsing first. Obsidian is forgiving about tables, you can drop one directly under a line of text with no blank line between them and it just works. The stricter markdown parser underneath Loremaster wanted that blank line or it would swallow the whole table as plain text. So I taught the renderer the same leniency it already had for lists: a table that starts right under a paragraph gets the breathing room it needs, automatically. Pipes inside code blocks are left alone, so a code sample with pipes in it does not accidentally become a table.

Then styling. Tables now render with proper bordered cells, a Cinzel gold header row, subtle zebra striping, a row highlight on hover, and per-column alignment honored from the markdown. Wide tables scroll sideways instead of blowing out the layout. And it all looks identical in the dossier, the split preview, and the standalone editor, because it is the same styling in every place.

Pictures in the page

The other rendering gap was images. Obsidian embeds them with ![[image.png]], and Loremaster now does the same. Drop that syntax in a note and the image renders inline, served straight out of the vault. It resolves by filename the way Obsidian does, so it finds the file even if it lives in an attachments subfolder, and it handles filenames with spaces.

Dimensions came along for free since I was already parsing the syntax. ![[map.png|250]] sets the width, ![[map.png|100x100]] sets width and height, and both the plain x and the fancy multiplication sign work. Images get a light frame and rounded corners to sit in the parchment theme, and they cap at the page width so a giant map does not overflow. Anything that is not an image, a linked PDF or a note reference, falls back to a link instead of breaking.

Which means artifact notes like the Moonveil Prism, or a location with a map, finally look in Loremaster the way they look in Obsidian, embedded art and all.

One more thing at the table

Part 2 pulled the NPC Conjurer and the Loot Roller into the session side panel as collapsible tool panels. There was always a third tool I reached for more than either of them and had not wired in yet: my Dice Tray.

It is in the panel now, sitting above the other two, because during play it is the thing I touch most. Same treatment as the others: a collapsible iframe, closed by default, lazy-loaded so it costs nothing until you open it, with a pop-out link if you want it full-screen, and its open or closed state remembered per session. It slotted in cleanly because the panel was built to accept exactly this, drop the tool's HTML in the tools folder and register one line. The pattern paid off the first time I extended it.

What it feels like now

The loop is closed. For two devlogs Loremaster could show me my world and let me run a session from it, but it could never change a word. Now I can read a dossier, notice something wrong, fix it in place, and watch the corrected version render, without ever leaving the page. I can write a whole new session note with the outline colored as I go and last week's reference on screen next to me. I can embed the map, drop in the stat table, roll the dice, all in one window.

Read-mostly became read-write. The difference is that it became read-write safely, with a commit behind every save and a trash folder behind every delete, so trusting it with the real vault was never a leap of faith.

What's next

The editor is the piece I have wanted for a long time, and it is done. The list from here has not changed much:

  • Session Mode: a live initiative and HP tracker overlay for combat, built on the AC, HP, and initiative I already surface on the mini-cards.
  • Child-locations panel on location dossiers, so a Region note auto-lists its cities and villages.
  • Light and dark toggle: the theme is already driven entirely by CSS variables, it just needs the switch.
  • Rolling Companions into their own section the way PCs got one.
  • Editor polish: a few keyboard niceties, and better handling of very long wrapped lines in the colored view.

But the honest summary is that the tool now does the three things I set out for it to do. It shows me my world, it runs my sessions, and it lets me write. Everything past this is refinement on a thing I already use every week.

If you are a DM running Obsidian and any of this maps onto your problem, say so. I will clean up the code and share it once the base is stable.