Skip to content

Releases: wilfriedago/obsidian-tinymist

0.6.0

Choose a tag to compare

@github-actions github-actions released this 15 Oct 23:09
Immutable release. Only release title and notes can be modified.
063a820

Added

  • A word count in the status bar. While a Typst document is open, the
    status bar shows its words, characters, spaces, and CJK characters, counted
    by Tinymist from the compiled document, so markup and code are left out. CJK
    characters are counted apart from words, so the figure means something for
    Chinese and Japanese. The count follows each compile, and the last one stays
    while a compile is running or has errors. Obsidian's own word count and
    backlinks, which only understand Markdown, are hidden while a Typst document
    is active. Requested in
    #27.

0.5.1

Choose a tag to compare

@github-actions github-actions released this 06 Oct 11:50
Immutable release. Only release title and notes can be modified.
e1a4993

Added

  • A Support group at the bottom of the settings. Two buttons — Star on
    GitHub
    and Buy me a coffee — that open in your browser when clicked,
    and do nothing otherwise: no popups, no startup notices, no network
    requests. The manifest also declares the funding link, so Obsidian shows it
    beside the plugin.

0.5.0

Choose a tag to compare

@github-actions github-actions released this 05 Oct 14:22
Immutable release. Only release title and notes can be modified.
f38f574

Added

  • BibLaTeX bibliographies open in Obsidian. .bib files were not
    registered, so Obsidian hid them and could not open them, even though Typst
    read them fine. They now open in an editor of their own, highlighted, and
    New BibLaTeX file is offered beside New Typst file. An open
    bibliography is kept in step with Tinymist, so a citing document compiles
    against unsaved edits and a parse error is underlined in the bibliography
    itself. If another plugin already opens .bib files, it keeps them.
    Requested in
    #11.
  • YAML and TOML files open in Obsidian, Hayagriva bibliographies
    included.
    .yml, .yaml, and .toml were hidden like .bib. They now
    open in the same editor, highlighted, and a document that reads one — a
    Hayagriva bibliography, typst.toml, or data loaded with yaml() or
    toml() — compiles against unsaved edits. New Hayagriva file joins the
    menu. This claims every such file in the vault, so Editor → Open YAML and
    TOML files
    can hand them to another plugin instead.

Changed

  • A new file opens ready to be named. Untitled is selected in the tab
    title, as it is for a new note or canvas, or asked for in a dialog when the
    tab title bar is hidden. Typst and bibliography tabs can also be renamed from
    their title now; before, it was read-only.

Fixed

  • Ctrl/Cmd+F opens the search bar in Typst, bibliography, and data files.
    Obsidian's own find hotkeys took the key first and only act on Markdown
    notes, so nothing happened. Ctrl/Cmd+Alt+F opens the same bar with the
    cursor in the replace field. Thanks to
    @pcastro93 in
    #22.
  • A stray @ no longer breaks BibTeX highlighting. The BibTeX tokenizer
    now handles it correctly, so the rest of the file stays highlighted. Fixed in
    #38.
  • The ready-status icon now matches the ready state. presentStatus now
    uses the correct icon for that status.

0.4.0

Choose a tag to compare

@github-actions github-actions released this 22 Sep 19:46
1f352a3

Added

The preview renders only the pages on screen.

Tinymist supports partial rendering and the plugin was never asking for it, so every preview sent and drew the entire document. Measured on a 316-page document: 1.1 MB of payload before anything appeared. This matches the default in Tinymist's own VS Code extension.

Turn it off under Preview → Render only visible pages if a document ever draws incorrectly.

While measuring this I checked the assumption behind it — that a large document recompiles from scratch on every keystroke. It does not. Typst memoizes: on that same 316-page document a cold compile is 854 ms while an edit is 0–25 ms, whether it lands at the start, middle or end, and the preview transport already sends ~9 KB deltas. The expensive part was only ever the initial payload.

Fixed

External edits now reach the preview, and Undo can no longer revert them.

Editing a .typ file outside Obsidian reloaded the buffer but never told Tinymist, so the preview silently showed the old document. Worse, the reload entered undo history — so Undo could restore the pre-edit text, and the next save wrote it back to disk.

Reloads now sync to Tinymist without requesting another save, stay out of undo history, and the language-server document is closed only after the base view's save completes.

Thanks to @jas-ho for finding and fixing this in #10 — with 22 regression tests, including surrogate-pair edge cases and the failed-save path.

Known limits of that fix: keep the source tab open while editing externally; preview-only reloads are not covered, simultaneous writes from two editors are not coordinated, and reloads during IME composition are unverified.


Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.3.1...0.4.0

0.3.1

Choose a tag to compare

@github-actions github-actions released this 22 Sep 09:21
f1a0665

A code-quality fix with no behaviour change. Upgrading from 0.3.0 is optional.

Fixed

  • Removed an await on Workspace.requestSaveLayout. It is typed Debouncer<[], Promise<void>>, and calling a debouncer returns the debouncer rather than a promise — so the await resolved on the next microtask and guaranteed nothing.

The layout was already being saved on Obsidian's own schedule, and still is.


Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.3.0...0.3.1

0.3.0

Choose a tag to compare

@github-actions github-actions released this 22 Sep 08:55
a89e08b

Reported in #7.

Added

The preview follows the document you are editing. Switching to another .typ file re-points an open preview at it, instead of leaving it showing whichever file it was opened with. Turn it off under Preview → Follow the active document, which sets what a new preview does.

A pin, per preview. The pin in a preview's toolbar holds it on one document while you edit others — the counterpart to following, for anyone who keeps one main file on screen. The choice is remembered per leaf and survives a restart.

The preview can take over the editor's tab. A second button in the .typ tab header, and the Typst: Open preview in this tab command, show the preview in place of the editor rather than beside it — the only way it fits on a narrow window. The preview's Open source button goes back. A preview of that document that is already open is revealed instead, since one Tinymist task serves one document.

Fixed

  • A preview that changed document left the previous one's Tinymist server running. Re-pointing now releases the old task, and a task is only stopped once no preview is showing it — so two previews on the same document no longer take each other's server down.
  • A preview's theme choice is written to the workspace when it is made, rather than whenever Obsidian next happened to save the layout.

Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.2.1...0.3.0

0.2.1

Choose a tag to compare

@github-actions github-actions released this 18 Sep 07:10
0777d5e

Fixed

The preview no longer reloads itself for no reason.

A console dump from real use showed the preview frontend initialising three times: twice against the same port, then once against a new one. The third is expected — changing the theme restarts the task. The first two were a bug.

Obsidian may call onOpen and setState in either order and both trigger a render, and nothing compared the resolved URL against what the frame was already showing. So the frame was torn down and rebuilt against an identical URL: two megabytes of preview frontend re-downloaded and its WebAssembly re-initialised to display what was already on screen.

Renders are now serialised, so two concurrent ones cannot build two frames, and skipped when the URL is unchanged — which also preserves your scroll position.

Switching the preview theme now shows Reloading… rather than going blank without explanation.

Two things in that report I cannot fix

Both are now written down as R11 and R12 in docs/risks.md.

The console flood is upstream. Lines like recv diff-v1 1388 and parse 0.20 ms, rerender 2.20 ms come from Tinymist's preview frontend, not this plugin — they are prefixed (index) and served from http://127.0.0.1:<port>. Not one of those strings exists in the built main.js. This plugin's logging is prefixed [tinymist: and is off below warn by default, so filtering the console on [tinymist: shows only its output.

It cannot be silenced from here: the preview runs in a cross-origin iframe on purpose, because that boundary is what keeps rendered documents away from Obsidian's DOM and APIs. The one technique that would work — patching the HTML and serving it from a blob — would move the frame into Obsidian's own origin and destroy that isolation. Quieter logs are not worth it.

The theme reload is inherent, for the same reason. Colour inversion is fixed when a preview task starts, and Tinymist's ControlPlaneMessage has no message to change it afterwards. The frontend can toggle it live, but only through its own keypress handler — on the far side of the same boundary. A CSS filter: invert() on the iframe would avoid the restart and also invert every photograph and figure, which is exactly why Tinymist treats images separately.

Both would be fixed by upstream changes, and both are worth asking for.


Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.2.0...0.2.1

0.2.0

Choose a tag to compare

@github-actions github-actions released this 18 Sep 01:05
2f93cc6

Added

Create a Typst file from the file explorer.

Right-click any folder and choose New Typst file — it sits beside Obsidian's own New note and New folder, not appended at the bottom of the menu.

There is also Typst: Create new Typst file in the command palette, which puts the file wherever your Default location for new notes setting points, rather than guessing at the vault root.

Obsidian's New note always makes Markdown and its dropdown cannot be extended by a plugin, so until now a .typ file had to be created some other way. That was documented as a limitation; making a new document is the first thing anyone does, so it should not have been one.

Details worth knowing

  • The file is created empty, matching what New note does. Seeding a template would be a guess about the document you want, and a wrong guess is more annoying than an empty file.
  • Naming follows Obsidian's own convention — Untitled.typ, then Untitled 1.typ — so the result looks like it belongs beside your Markdown notes.
  • An existing Untitled.md does not push the count; only .typ names are considered.

Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.1.7...0.2.0

0.1.7

Choose a tag to compare

@github-actions github-actions released this 17 Sep 23:59
400a15b

Fixed

Formatting no longer destroys the top of the file.

Tinymist's formatter returns a single text edit, and I assumed a single edit meant the whole document. It does not — the range starts at the first line the formatter actually wants to change:

range: start {line: 2, character: 6} → end {line: 11, character: 10}

Treating that edit's text as the new document deleted everything above it. In a real Typst file that is the #import line and the opening of the #show rule.

Edits are now applied as ranged changes:

  • nothing outside a range is touched
  • the caret is mapped through the change instead of reset
  • a format is a single undo step
  • overlapping edits are refused rather than applied halfway
  • the buffer is compared against its pre-request snapshot, so a keystroke arriving mid-flight cannot make stale offsets land in the wrong place

Selected text is readable in dark mode.

CodeMirror's base theme styles the focused selection five classes deep and hard-codes a pale lavender — and it picks light-vs-dark from its own theme flag, not Obsidian's. So a dark vault got pale lavender behind light text.

The plugin's rules now match that specificity and take their colour from Obsidian's accent, at an alpha that tints rather than covers, in both light and dark mode. Dark gets slightly more opacity to register at all.

Themes and snippets can override the whole thing:

.tinymist-editor { --tinymist-selection: hsla(160, 50%, 45%, 0.3); }

Note on severity

This was tracked as a low severity risk, on the reasoning that typstyle emits whole-document output. That was reasoning about what the formatter ought to return rather than asking it. The integration suite now asserts the range is not whole-document, so the day that changes, a test says so rather than a user.

211 tests.


Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.1.6...0.1.7

0.1.6

Choose a tag to compare

@github-actions github-actions released this 17 Sep 23:39
9a15d57

Fixed

Clicking the preview moves the cursor.

Tinymist reports a preview-to-source jump one of two ways, and the client chooses which: with customizedShowDocument set it sends a tinymist/preview/scrollSource notification, and without it a standard window/showDocument request. The plugin set neither — so it was subscribed to a notification that was never sent, while answering the request it did receive with "method not found".

It now sets the option and handles the standard request, so the feature cannot be switched off by a configuration change or a future default.

Source and preview no longer echo each other.

Answering a preview click moved the caret; the caret move was reported back to the preview; the preview scrolled again. The caret move the plugin makes now carries a CodeMirror annotation, and the update listener ignores annotated transactions, so only your own caret moves reach the preview. A pending cursor push is dropped when a jump arrives.

An annotation rather than a "recently jumped" timer, because it is exact and cannot misfire under load. A test asserts it does not persist into your next caret move — that would silently disable source-to-preview sync.

Changed

  • Removed a redundant type assertion in the PDF decoder, and pinned the pooled-buffer behaviour its comment describes: Node allocates small buffers from a shared pool, so the exact byte range must be copied out rather than the whole backing store handed to the vault.

Verification

The click path was confirmed end to end against a real Tinymist by driving the preview's own websocket with src-point {"page_no":1,"x":100,"y":60} — exactly what the frontend sends on click — and asserting a source location comes back. Both transport paths were checked; the notification path is now an integration test. Clicks landing on whitespace correctly map to nothing, which is why it tries several points.

204 tests.


Requires Tinymist 0.13.0 or newer, installed separately. Obsidian 1.13.0+, desktop only.

Full changelog: 0.1.5...0.1.6