Repository navigation
Closed
Labels
enhancementNew feature or request
Description
The problem
Developers keep their docs in Markdown, and cat README.md in EmberTerm prints raw source. Reading a README, a changelog or a runbook means leaving the terminal for an editor or a browser.
What you would like
A closable right-side panel in the tab that renders one Markdown file (.md / .markdown), so docs can be read next to the shell. Markdown only: other formats were cut to keep size and risk small.
Static mockup, colours approximate. The real panel uses the existing theme tokens.
Goals
- GitHub-flavoured Markdown: tables, task lists, strikethrough, autolinks, highlighted code blocks, heading anchors, local relative images.
- Relative
.mdlinks open in the same panel (back/forward),#anchorlinks scroll inside it,http(s)links use the existing opener. - Live reload when the file changes on disk, keeping the scroll position.
- Works for Git Bash, WSL and pwsh paths (cmd: explicit trigger only).
Triggers
- Phase 1, explicit: Ctrl+click a
.mdpath in the output, a palette action "Preview Markdown file…", and a shortcut. - Phase 2, opt-in: auto-open on
cat/bat/less/type/Get-Contentwith exactly one.mdargument. Setting, default off. The OSC 133;E command mark already reaches the app, so no new shell hooks.
Non-goals
Editing, export, in-panel search, other formats (PDF, HTML, JSON, mermaid, math), remote images, files over 1 MB, restoring the open panel after a restart.
How it would work
- Rendering in the frontend:
marked+DOMPurify, plushighlight.jswith a fixed language subset. All of it is a lazy chunk loaded on first open. - Rust only reads files:
file_preview,file_preview_image,file_preview_stat, plus a pure path-resolution function (Git Bash/d/x→D:\x, WSL/mnt/d/xand\\wsl.localhost\<distro>\...;msys_to_windowsalready exists). No new crates. - The panel is a column in
TabPane, outside the two-pane split model, sosession.jsonand the split model do not change. - Security: Markdown from a cloned repo is untrusted. Output is always sanitized before insert, remote images are replaced by a placeholder, images load as
data:URLs, and the CSP stays unchanged.
Budget (to be measured in the PR, not assumed)
- Main bundle (583 KB JS today) stays within about 1.5% growth; the renderer and highlighter are lazy chunks.
- Markdown chunk about 50 KB gzip or less, highlight chunk about 60 KB gzip or less.
- No long task over 100 ms when rendering a 200 KB document. If a 1 MB document is janky, render in Rust (
pulldown-cmark+ammonia) later; the swap touches one function. - No timers or polling when no panel is open. The release binary grows by about the size of the new lazy chunks (assets are embedded uncompressed); measured in the PR. PTY flood benchmark within noise with a panel open.
Suggested slices
- Rust: file commands, path resolution, tests
- Panel shell: tab state, divider, close, status-bar item
- Renderer: sanitize, link/image/anchor rewriting, sanitizer tests
- Syntax highlighting chunk and token colours
- Explicit triggers: link provider, palette action, shortcut
- Live reload
- Auto-open on
cat(setting, default off) - Docs, CHANGELOG, Keymap/Settings entries, size and perf numbers
Other ways you considered
- Rust-side rendering: flat webview bundle and off-UI-thread render, but two new crates. Kept as the fallback if big documents measure slow.
- Sandboxed iframe: rejected, the CSP has
frame-src 'none'. - Auto-open only (no explicit trigger): rejected,
cat huge.logorcat a.md | grep xwould surprise people.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity