You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(fold): toggle folds and expandable regions with za / <CR> (#21)
Folds (callouts/details) and expandable regions (truncated code blocks
and tables) could previously only be toggled by clicking. Bind `za` and
`<CR>` in the preview buffer to toggle the block under the cursor, so the
preview is usable without a mouse.
- `za` toggles the fold/region under the cursor (no-op otherwise).
- `<CR>` toggles the block under the cursor, otherwise closes the window
when it is a close key (float/tab mode), and is a no-op in toggle mode.
- Extract side-effect-free `fold_at` / `region_at` finders shared by the
mouse and keyboard handlers; mouse behavior (incl. URL precedence) is
unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-**画像** — ローカルおよび Web 画像(PNG, JPEG, WebP, GIF, アニメーション GIF)をターミナルグラフィクスプロトコルでインライン表示
18
18
-**動画** — ローカルおよび Web 動画(MP4, WebM, MOV, AVI, MKV, M4V)をアニメーションフレームとしてインライン再生
19
19
-**Mermaid ダイアグラム** — 画像としてインライン表示
20
20
-**CJK 対応ワードラップ** — JIS X 4051 禁則処理 + [BudouX](https://github.com/google/budoux)([budoux.lua](https://github.com/delphinus/budoux.lua) 経由)によるオプションのフレーズ分割
-**Tables** — box-drawing borders, column alignment, proportional sizing, and inline formatting within cells
15
-
-**Callouts & folds** — GitHub and Obsidian alert types with colored borders, icons, and click-to-toggle folding
16
-
-**Code blocks** — fenced blocks with treesitter syntax highlighting; expandable when truncated
15
+
-**Callouts & folds** — GitHub and Obsidian alert types with colored borders, icons, and folding you can toggle by clicking or with `za` / `<CR>`
16
+
-**Code blocks** — fenced blocks with treesitter syntax highlighting; expandable when truncated (click or `za` / `<CR>`)
17
17
-**Images** — local and web images (PNG, JPEG, WebP, GIF, animated GIF) displayed inline via terminal graphics protocol
18
18
-**Video** — local and web video (MP4, WebM, MOV, AVI, MKV, M4V) played as animated frames inline
19
19
-**Mermaid diagrams** — rendered as images inline
20
20
-**CJK-aware word wrapping** — JIS X 4051 kinsoku shori + optional [BudouX](https://github.com/google/budoux) phrase segmentation via [budoux.lua](https://github.com/delphinus/budoux.lua)
21
21
-**Clickable links** — mouse click to open URLs; hover the mouse over a link to peek the full URL in a subtle floating window; OSC 8 hyperlink support for compatible terminals
22
-
-**`<details>` support** — collapsible sections with click-to-toggle, respecting the `open` attribute
22
+
-**`<details>` support** — collapsible sections you can toggle by clicking or with `za` / `<CR>`, respecting the `open` attribute
23
23
-**Library API** — use the rendering engine programmatically from your own plugins
|`<Plug>(md-render-split)`| Open a split showing source and rendered Markdown |
145
145
|`<Plug>(md-render-demo)`| Show a demo window with all supported Markdown notations |
146
146
147
+
### In-preview keys
148
+
149
+
Inside a rendered preview (floating, tab, or in-place toggle), these buffer-local keys are set automatically:
150
+
151
+
| Key | Action |
152
+
|---|---|
153
+
|`za`| Toggle the fold / expandable region under the cursor (no-op elsewhere) |
154
+
|`<CR>`| Toggle the fold / expandable region under the cursor; otherwise close the window (in floating / tab mode) |
155
+
|`<LeftMouse>`| Toggle folds, expand regions, and open links by clicking |
156
+
|`q` / `<Esc>`| Close the window (floating / tab mode only) |
157
+
147
158
## Commands
148
159
149
160
The plugin exposes a single `:MdRender` command with subcommands:
@@ -178,7 +189,7 @@ Behavior:
178
189
- When the same source is shown in multiple windows, only the invoking window swaps; edits from other windows are reflected on the next toggle into render mode.
179
190
- Cursor position round-trips between source and render via the source-line mapping.
180
191
-`number`, `relativenumber`, and `list` are turned off on render-mode windows. The originals are stashed on the window and restored when toggling back to source.
181
-
- Inside render mode, `q` / `<Esc>` / `<CR>` are **not** bound to close — call `:MdRender toggle` again to return to source mode. `<LeftMouse>`still toggles folds, expands regions, and opens links.
192
+
- Inside render mode, `q` / `<Esc>` / `<CR>` are **not** bound to close — call `:MdRender toggle` again to return to source mode. `<LeftMouse>`, `za`, and `<CR>`still toggle folds and expand regions (and `<LeftMouse>`opens links).
0 commit comments