Files
paseo/plugin-examples/markdown-panel/README.md
T
Mohamed Boudra dfb6215de0 feat(file-panels): panels read and write through a file handle
The file tab stats the file and mounts its panel without reading it. Every
panel, built-in or plugin, gets a PluginFile handle: readText, readBytes, url,
version-checked writeText/writeBytes (PluginFileConflictError unless force),
and watch. useFileText, useFileBytes and useFileUrl read through it, and
Loading joins @getpaseo/plugin/client/ui. Panels own their loading state.

The host document pipeline, the explorer preview cache and the preview
lifecycle are deleted. The daemon classifies a file version from a bounded
sniff and writes base64 content as bytes behind fileByteWrites.

A deleted file keeps its panel mounted; a read confirms the deletion first,
so a remove-and-rewrite is not reported as one. Native Source decodes with
builtins and highlights in idle-time slices, the lines around the opening
line first, so a large file no longer blocks the JS thread.
2026-10-20 08:02:49 +02:00

1.2 KiB

Markdown file panel example

Requires Paseo 0.13.0 or later. Install the editor dependencies, then install this directory:

cd plugin-examples/markdown-panel
npm install
paseo plugin install "$PWD"

Open a .md or .markdown file in Files. Choose Rich Markdown — markdown-panel in the picker. Check Don't ask me again to remember the choice on this device.

The panel is a CodeMirror editor with Markdown highlighting, line numbers, undo, redo, and line wrapping. It reads the file once with readText, saves 500 ms after the last edit with writeText, and reports unsaved edits with tab.setModified. When the file changes on disk with nothing unsaved, it reads again; with unsaved edits, or when a write rejects with PluginFileConflictError, it offers Reload and Overwrite. The bar's switcher still offers Paseo's Markdown and Source panels. Native shows selectable, read-only text through useFileText.

Paseo bundles the editor dependencies into this plugin. They are loaded only on web; the native path uses React Native primitives. DOM integration lives in client/web.ts.

See the file panel reference.