Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ body:
attributes:
label: Toril version
description: Help → About, or the release you installed. If you built from source, give the commit.
placeholder: "v1.1.1"
placeholder: "v1.1.2"
validations:
required: true

Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,43 @@ GitHub Release notes plus the commits that shipped in it.

## [Unreleased]

## [v1.1.2] — 2026-11-09

Saving a note in an Obsidian vault no longer breaks its links, embeds and callouts, and
notes containing ©, ® or ™ open again.

### Fixed
- **Saving a note no longer breaks Obsidian links, embeds and callouts.** When you edited a
note in an Obsidian vault, saving it rewrote `[[Pneumothorax]]` as `\[\[Pneumothorax]]`,
`![[scan.png]]` as `!\[\[scan.png]]`, and `> [!tip]` as `> \[!tip]`. Obsidian shows those
as plain text, so every link, embedded image and callout in that note stopped working.
Notes you only opened were never affected; notes you edited were. They now save
exactly as written.

If a note was saved by an earlier version, its links are still escaped on disk. Removing
the backslashes is safe: open the note in Toril, make any edit, and save. Toril writes
the links back without them. Version history also holds the copy from before Toril
first saved it.

- **Toril no longer adds backslashes to ordinary text.** `figure [1]`, `~3 cm`, `5 * 3`,
`snake_case` and bare web addresses are left as you typed them. A backslash is now
written only where the text would otherwise change meaning, such as a line that would
turn into a heading or list. Every save checks this by re-reading what it is about to
write and comparing it with your note, so no backslash is removed where it is needed.

- **Notes containing ©, ® or ™ open again, and those symbols are kept when you save.**
Any note with one of them failed to open with *"RangeError: Invalid array passed to
renderSpec"*. The emoji support treated the three symbols as emoji it could not draw, and
a save would also have deleted them: `Omnipaque® and Visipaque™, © 2026` would have been
written as `Omnipaque and Visipaque, 2026`. They are now ordinary text. The emoji
versions (©️ ®️ ™️, as an emoji keyboard or `:tm:` types them) are unchanged.

- **A note that fails to open no longer leaves a broken tab behind.** After a failed open,
the new tab stayed selected while the editor still showed the previous note, and
pressing Save could write the wrong text into the file that had failed to open. Toril
now stays on the note you were in and reports the error, including when you open a note
from the sidebar, which previously failed without any message.

## [v1.1.1] — 2026-10-15

### Fixed
Expand Down
49 changes: 43 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,32 @@ the feature-by-feature record.
**Known trade-off:** Toril's canonical form (`src/editor/canonical.ts`) is `-` bullets and `---`
thematic breaks, matching Obsidian — so most notes survive open→save untouched. Some constructs
still reformat (setext headings, indented code blocks, `~~~` fences, two-space hard breaks, link
reference definitions, `*`/`+`-authored bullets, `1)` ordered markers, over-indented nesting, bare
URLs, and **CRLF line endings → LF**, which rewrites every line of a Windows-authored note); the
reference definitions, `*`/`+`-authored bullets, `1)` ordered markers, over-indented nesting,
`<angle-bracket>` autolinks → bare URLs, superfluous backslash escapes dropped, and **CRLF line
endings → LF**, which rewrites every line of a Windows-authored note); the
`normalized` class in `tests/roundtrip.test.ts` is the authoritative list — each entry pinned to its
exact output. The reformatting is idempotent and never drops *rendered* content; the one known
exception is that an **unused link reference definition is deleted outright** (see the deferred list
above). Relevant to Obsidian-vault diffs (§1).

**Escapes are minimal and proven — `fix/obsidian-syntax-escaping`.** remark-stringify escapes
defensively (every `[`, `*`, `_`, `~`), which was a §3 bug, not a style issue: saving an edited
note rewrote `[[Note]]` as `\[\[Note]]`, `![[x.png]]` as `!\[\[x.png]]` and `> [!tip]` as
`> \[!tip]` — literal text in Obsidian, so every wikilink, image embed and callout in that note
broke. It also rewrote ordinary prose (`figure [1]`, `~3 cm`, `snake_case`). `docToMarkdown`
(`serializer.ts`) now passes the escaped output through `src/editor/escapes.ts`, which removes
each escape **only if re-parsing proves the document unchanged** — never by re-implementing
CommonMark's escaping rules. Per-block bisection (memoized, so between keystrokes only the edited
block re-parses), then one whole-document parse as the proof; if that fails (a block whose meaning
depends on another, e.g. a reference definition), a bounded whole-document search. Cost: roughly
one extra full parse per serialization (~12 ms at 800 words, ~180 ms at 12k words in jsdom), paid
on the debounced change listener. Rules for whoever touches it: the property gate compares against
the **fully escaped** output, not the live doc, because two upstream quirks are lossy or unstable
with or without this module — remark moves a space out of a strikethrough boundary
(`~~a ~~b` shapes), and **a bare URL ending in `\` gains a backslash on every save** (pre-existing on
`main`, not yet fixed). Table column padding is computed before minimization, so a cell holding
`[[x\|y]]` may pad a character or two wide (pinned as `wikilinkAliasInTable`).

**HTML as a first-class editable format — shipped in v0.1.1-alpha.1.** Open/edit/save `.html`
WYSIWYG alongside `.md`, motivated by AI assistants emitting rich HTML instead of Markdown. The editor
engine is unchanged — HTML is the native shape of a ProseMirror doc, so it is a second canonical
Expand Down Expand Up @@ -344,6 +363,8 @@ toril/
│ ├── editor/
│ │ ├── milkdown.ts # WYSIWYG setup + plugins (incl. clipboard-image paste, §6)
│ │ ├── serializer.ts # the ONE markdown <-> doc converter (§3.2)
│ │ ├── escapes.ts # proof-checked escape minimization, used only by serializer.ts
│ │ ├── emoji.ts # the ONE emoji stack: upstream + ©/®/™ kept as text (§6)
│ │ ├── html-serializer.ts # the ONE HTML <-> doc converter (§3.2/§3.3)
│ │ └── html-constructs.ts # richer HTML-only schema: callout/details/dl/mark/sub/sup (§6)
│ ├── ui/
Expand Down Expand Up @@ -615,7 +636,7 @@ frontend never touches the filesystem directly; it asks via `invoke()`.
| WYSIWYG core | `@milkdown/core` + `@milkdown/preset-commonmark` |
| GFM (tables, task lists, strikethrough) | `@milkdown/preset-gfm` |
| Math (KaTeX) | **Deferred** — `@milkdown/plugin-math` is deprecated; omitted until a maintained option exists (§0/§8) |
| Emoji shortcodes | `@milkdown/plugin-emoji` |
| Emoji shortcodes | `@milkdown/plugin-emoji`, assembled **only** in `src/editor/emoji.ts` (app and every gate import `emoji` from there). That module adds one remark step: an emoji node twemoji did not draw as an `<img>` (bare ©, ®, ™ — `emoji-regex` matches them, twemoji leaves them as text) goes back to plain text. Upstream made them nodes that crash the view on load (prosemirror-model ≥ 1.25.5 rejects the Text node `toDOM` returns) **and** serialize to nothing. **Do not upgrade to 7.23.0 thinking it fixes this**: it fixes the crash, not the deletion on save |
| Inline / slash shortcuts | `@milkdown/plugin-slash` + keymap config |
| Formatting toolbar | `toolbar.ts` → Milkdown commands via `callCommand` (the few command-less items use a plain ProseMirror transaction); **never inserts raw markdown text** (§3.2). Buttons reflect active state via `activeState()`. The pure command layer is exported separately from the DOM so the gate tests it headlessly. *Underline omitted by design* (no markdown form). *Front-matter button deferred* (not lossless yet). |
| Front matter | **Not a Milkdown plugin, by design** — `src/editor/frontmatter.ts` splits the block off at the load/serialize boundary so it never enters the ProseMirror doc (§3). Edited in `src/ui/properties.ts`, a collapsible strip above the writing surface: typed rows for a block that provably re-serializes byte-exact, raw text for anything else |
Expand Down Expand Up @@ -657,15 +678,24 @@ Phases 0–3 are complete and Phase 4 (polish) is in progress; the shipped detai
**Gates (all green) — keep them green:**
- **Atomic save:** `cargo test -p fsatomic` — interrupting a save leaves the original intact (§3.1).
- **Round-trip:** `tests/roundtrip.test.ts` — real Milkdown in jsdom, built through
`canonical.ts` so the gate tests the canon that ships. Three classes: `fixtures`
`canonical.ts` so the gate tests the canon that ships. Classes: `fixtures`
(canonical input is stable), `preserved` (human/Obsidian-authored input is **not**
rewritten), `normalized` (what we do rewrite, pinned to exact output), and
rewritten), `obsidianPreserved` (wikilinks, embeds, callouts, `==highlight==`,
`%%comments%%`, block IDs, nested tags, Anki cloze — Obsidian syntax Toril does not
render yet but must never break), `escapesKept` (the escapes that *are* needed —
task markers, heading/list/quote markers, raw HTML — stay), `normalized` (what we
do rewrite, pinned to exact output), and
`frontMatter` (**whole-file** trip — split, round-trip the body, rejoin — the class
that pins the §3 front-matter fix, including blocks no serializer could reproduce).
Add math fixtures if math ever lands (§3.2). Plus `tests/frontmatter.test.ts`, the
splitter's own gate: `join(split(x)) === x` over fixtures *and* 2000 randomized
documents, detection per format, and the Rust-parity cases mirrored in
`mdhtml`/`mdrtf`.
`mdhtml`/`mdrtf`. Plus `tests/escapes.test.ts` — the minimizer's own gate: the
bisection (joint verification, so `\*a\*` never loses both escapes), the
whole-document fallback, the parse budget, a throwing parser read as *inequality*,
and a 200-case randomized property over the real parser (the saved file loads
exactly as the fully escaped file would, and is stable wherever the old output was).
Verified with teeth: forcing the verifier to accept everything fails 8 tests.
- **Front-matter properties:** `tests/frontmatter-values.test.ts` — Obsidian's own
writes come back as typed rows (the feature is useless otherwise), and everything
we would *reformat* lands in raw mode instead: comments, anchors, flow sequences,
Expand Down Expand Up @@ -731,6 +761,13 @@ Phases 0–3 are complete and Phase 4 (polish) is in progress; the shipped detai
in the **future** fails *open* — a corrected clock must not disable update checks
forever with no symptom. What it cannot cover is anything downstream of the network:
see §D of `docs/ON-DEVICE-VERIFICATION.md`.
- **Emoji / symbols:** `tests/emoji.test.ts` + `trademarkSymbols`/`symbolsBesideEmoji` in the
round-trip `preserved` class — ©/®/™ parse as text, load into a *mounted* view, and save
byte-exact, while the emoji-presentation forms (©️ ®️ ™️) stay image emoji. Red before the fix.
- **Failed loads:** `tests/tabs.test.ts` ("an activation that throws") — a document the editor
cannot load never becomes the active tab. `onActivate` throws *after* the editor state was
replaced, so `setActive` restores and reloads the previous tab, never flushes the editor into
the failed one, and rethrows; `openPath` then drops the never-activated tab.
- Plus `vaultscan`, `imgasset`, `theme`, `statusbar`, `search`, `security`, `tabs` suites.

> **The browser harness.** `dev-harness.html` is `app.html` plus a fake Tauri IPC bridge
Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It is built on Tauri 2, TypeScript, and Milkdown. The primary platform is

> **Status: 1.0.** The editor and the workflow around it work, and your notes stay
> plain files you can walk away with. Installers:
> **[v1.1.1](https://github.com/kovirlabs/toril/releases/latest)**.
> **[v1.1.2](https://github.com/kovirlabs/toril/releases/latest)**.
>
> Keep backups of anything important, as with any editor. See
> [CHANGELOG.md](./CHANGELOG.md) for what each release changed.
Expand Down Expand Up @@ -56,8 +56,10 @@ distinction matters, so they are listed separately.

**Not yet built:**

- Math rendering (KaTeX), PDF export, and in-editor YAML front matter.
- Global search across a vault, wikilinks, and backlinks.
- Math rendering (KaTeX) and PDF export.
- Global search across a vault, and wikilink navigation and backlinks.
Obsidian's `[[links]]`, `![[embeds]]` and `> [!callouts]` are kept intact when
Toril saves a note, but are not yet clickable or rendered.
- Signed installers, so Windows SmartScreen and macOS Gatekeeper warn on first
run. That is expected for an unsigned build, not a sign of a problem.

Expand All @@ -70,18 +72,18 @@ Installers are on the

| Platform | Download |
|---|---|
| **Windows** | [`Toril_1.1.1_x64-setup.exe`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_x64-setup.exe) |
| **Windows** (MSI, for IT deployment) | [`Toril_1.1.1_x64_en-US.msi`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_x64_en-US.msi) |
| **macOS** (Apple Silicon) | [`Toril_1.1.1_aarch64.dmg`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_aarch64.dmg) |
| **macOS** (Intel) | [`Toril_1.1.1_x64.dmg`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_x64.dmg) |
| **Linux** (AppImage) | [`Toril_1.1.1_amd64.AppImage`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_amd64.AppImage) |
| **Linux** (Debian/Ubuntu) | [`Toril_1.1.1_amd64.deb`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril_1.1.1_amd64.deb) |
| **Linux** (Fedora/RHEL) | [`Toril-1.1.1-1.x86_64.rpm`](https://github.com/kovirlabs/toril/releases/download/v1.1.1/Toril-1.1.1-1.x86_64.rpm) |
| **Windows** | [`Toril_1.1.2_x64-setup.exe`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_x64-setup.exe) |
| **Windows** (MSI, for IT deployment) | [`Toril_1.1.2_x64_en-US.msi`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_x64_en-US.msi) |
| **macOS** (Apple Silicon) | [`Toril_1.1.2_aarch64.dmg`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_aarch64.dmg) |
| **macOS** (Intel) | [`Toril_1.1.2_x64.dmg`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_x64.dmg) |
| **Linux** (AppImage) | [`Toril_1.1.2_amd64.AppImage`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_amd64.AppImage) |
| **Linux** (Debian/Ubuntu) | [`Toril_1.1.2_amd64.deb`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril_1.1.2_amd64.deb) |
| **Linux** (Fedora/RHEL) | [`Toril-1.1.2-1.x86_64.rpm`](https://github.com/kovirlabs/toril/releases/download/v1.1.2/Toril-1.1.2-1.x86_64.rpm) |

<details>
<summary><b>Installing on Windows</b></summary>

**1. Download** `Toril_1.1.1_x64-setup.exe` from the table above.
**1. Download** `Toril_1.1.2_x64-setup.exe` from the table above.

**2. Unblock it if Windows marked it.** Files downloaded from the internet carry
a "mark of the web". If the installer refuses to start, right-click it →
Expand Down Expand Up @@ -138,9 +140,9 @@ Toril…"*. Open **System Settings → Privacy & Security**, scroll down, and cl
> later. Nothing was wrong with the download itself.

**Linux:** the AppImage is portable —
`chmod +x Toril_1.1.1_amd64.AppImage` and run it. Or install the `.deb`
(`sudo apt install ./Toril_1.1.1_amd64.deb`) or `.rpm`
(`sudo dnf install ./Toril-1.1.1-1.x86_64.rpm`).
`chmod +x Toril_1.1.2_amd64.AppImage` and run it. Or install the `.deb`
(`sudo apt install ./Toril_1.1.2_amd64.deb`) or `.rpm`
(`sudo dnf install ./Toril-1.1.2-1.x86_64.rpm`).

</details>

Expand Down
Loading
Loading