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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.7.0 — 2026-08-14

### Added
- **Text selection and clipboard copy.** ink captures the mouse for wheel-scroll, which meant the terminal's own selection was unavailable; it now does the job itself:
- `v` starts a character-wise selection, `V` a line-wise one. `h j k l`/arrows, `w`/`b`, `0`/`$`, `g`/`G`, and `Ctrl+d`/`Ctrl+u` move the cursor end, the view follows it, `y` copies, `Esc` cancels. Selection edges are measured in terminal cells and snap to grapheme boundaries, so a wide CJK glyph or a ZWJ emoji is never cut in half.
- Mouse drag selects and copies on release; double-click takes the word under the pointer, triple-click the line.
- `c` labels every code block on screen and copies the one you pick — the block's raw source, with none of the box borders, syntax escapes, or margin that surround it on screen.
- `Y` copies the markdown source of the section you are reading, down to the next heading of the same or higher level. Inside link-hint mode (`f`), `Y` flips the labels from "open this link" to "copy this URL".
- Copies go out over **OSC 52** (works across SSH, wrapped for tmux) *and* through a native helper (`pbcopy`, `wl-copy`, `xclip`, `xsel`, `clip.exe`) when one is on `PATH`. No new dependencies. `[behavior] clipboard = "auto" | "osc52" | "native" | "off"` narrows or disables it.
- New action IDs `select_mode`, `select_line_mode`, `copy_code`, and `copy_section` are rebindable like any other; visual-mode motions themselves are a fixed table, as with search and slides.
- Themes gained `selection_bg` / `selection_fg`. Both are optional — a theme file written before this release still loads and derives a legible selection from its existing colors.

### Fixed
- **Heading text is stripped of terminal control bytes where it is recorded**, not only where it is drawn as a line. A heading carrying an ESC byte reached the TOC sidebar unfiltered before; it now goes through the same sanitizer as body text, which also covers the new "copied section" status line. Fence info strings get the same treatment.

## 0.6.7 — 2026-07-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink-md"
version = "0.6.7"
version = "0.7.0"
edition = "2021"
authors = ["Amin Borghei <borghei.mohammadamin@gmail.com>"]
description = "The most advanced terminal markdown reader"
Expand Down
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,31 @@ Switch between them with `Tab` and `Shift+Tab`.

Press `/` to search within a document. Matches highlight inline; press Enter to lock in the search, then `n`/`N` to cycle forward and backward through results. `Esc` clears the highlights.

### Select text and copy it

ink captures the mouse for wheel-scroll, which used to mean giving up your terminal's own text
selection. Now it does the job itself, and does it better — it knows where a code block starts and
where ink's own decoration ends.

- **`v`** starts a character-wise selection, **`V`** a line-wise one. Move with `h j k l`, arrows,
`w`/`b` (word), `0`/`$` (line ends), `g`/`G` (document ends), `Ctrl+d`/`Ctrl+u` (half page).
**`y`** copies and exits; `Esc` cancels.
- **Drag with the mouse** to select, release to copy. Double-click takes the word, triple-click the
line.
- **`c`** labels every code block on screen — press its letter to copy the block's *raw* source: no
borders, no line numbers, no syntax-highlighting escapes.
- **`Y`** copies the markdown source of the section you are reading (heading included, down to the
next heading of the same level). Inside link-hint mode (`f`), `Y` switches the labels from
"open this link" to "copy this URL".

Copied text reaches the clipboard two ways at once: an OSC 52 escape sequence, which works over
SSH and inside tmux, and a native helper (`pbcopy`, `wl-copy`, `xclip`, `xsel`, `clip.exe`) when one
is installed locally. No extra dependencies, nothing to configure. Set `clipboard` in your config to
narrow it down or turn it off.

`v` and `V` copy lines the way they are drawn, ink's heading bars and code-box borders included —
they select what you can see. Reach for `c` and `Y` when you want the source instead.

### Open links from the keyboard

Press `f` to label every link on screen with a letter. Press that letter to open web and mail links in your browser, or to follow a relative `.md` link right inside ink.
Expand Down Expand Up @@ -218,7 +243,10 @@ ink diff old.md new.md
| `Ctrl+d` / `Ctrl+u` | Half-page down / up |
| `n` / `N` | Next / previous heading (cycles search matches after a search) |
| `/` | Search |
| `f` | Link-hint mode (open/follow links by letter) |
| `f` | Link-hint mode (open links by letter, `Y` to copy one instead) |
| `v` / `V` | Select text — character-wise / line-wise (`y` copies, `Esc` cancels) |
| `c` | Copy a code block by letter |
| `Y` | Copy the current section as markdown |
| `t` | Toggle table of contents |
| `T` | Theme picker (choice is saved to config) |
| `?` | Help overlay |
Expand Down Expand Up @@ -275,6 +303,13 @@ browser_loop = false
# Set false to let your terminal handle the mouse (click-to-open links, text
# selection) instead of ink capturing it for wheel-scroll. Default: true
mouse_capture = true

# How copied text reaches the clipboard:
# auto - OSC 52 escape (crosses SSH and tmux) plus a native helper, if present
# osc52 - escape sequence only
# native - pbcopy / wl-copy / xclip / xsel / clip.exe only
# off - copying is disabled
clipboard = "auto"
```

### Custom themes
Expand Down
4 changes: 4 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ <h3>Search</h3>
<h3>Table of contents</h3>
<p>Sidebar showing every heading. Tracks your scroll position.</p>
</div>
<div class="feature">
<h3>Select &amp; copy</h3>
<p><code>v</code>/<code>V</code> or a mouse drag selects text, <code>y</code> copies it. <code>c</code> copies a code block's raw source, <code>Y</code> the current section.</p>
</div>
<div class="feature">
<h3>Open links by keyboard</h3>
<p>Press <code>f</code> to label links, then a letter to open or follow them.</p>
Expand Down
9 changes: 7 additions & 2 deletions docs/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ink is a feature-rich terminal markdown reader built in Rust. It renders markdow
- Help overlay: press ? for a popup of the active keybindings
- Table of contents sidebar showing heading structure, tracks scroll position
- Navigation history with back/forward ([ ] keys or Alt+Arrow)
- Mouse wheel scrolling (can be disabled via behavior.mouse_capture so the terminal handles clicks/selection)
- Mouse wheel scrolling, plus drag-to-select (can be disabled via behavior.mouse_capture so the terminal handles clicks/selection instead)
- Event-driven redraw (no CPU when idle) and virtualized rendering for large documents
- Responsive to terminal resizing; shows a message instead of breaking on very small terminals

Expand Down Expand Up @@ -106,7 +106,11 @@ ink is a feature-rich terminal markdown reader built in Rust. It renders markdow
- Ctrl+d/Ctrl+u: half-page down/up
- n/N: next/previous heading (cycles search matches after a search)
- /: search
- f: link-hint mode (open/follow links by letter)
- f: link-hint mode (open/follow links by letter; Y inside the overlay copies the URL instead)
- v/V: select text character-wise / line-wise (motions hjkl, arrows, w/b, 0/$, g/G, Ctrl+d/Ctrl+u; y copies, Esc cancels)
- Mouse: drag selects and copies on release; double-click selects a word, triple-click a line
- c: label the code blocks on screen and copy one's raw source by letter
- Y: copy the current section as markdown source
- ?: help overlay
- t: toggle table of contents
- T: theme picker (saved to config)
Expand All @@ -131,6 +135,7 @@ frontmatter = false
[behavior]
browser_loop = false # return to browser after closing a doc
mouse_capture = true # set false to let the terminal handle clicks/selection
clipboard = "auto" # auto | osc52 | native | off — how copied text reaches the clipboard

[keybindings]
preset = "emacs" # default | vim | emacs
Expand Down
1 change: 1 addition & 0 deletions docs/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ink is a command-line tool that renders markdown files in the terminal with rich
- Supports wikilink syntax: [[page]] and [[page|display text]]
- Renders inline/block math ($...$, $$...$$) in code style and resolves :emoji: shortcodes
- Interactive TUI with multi-tab support, in-document search (n/N to cycle matches), keyboard link opening (press f), a help overlay (?), and a table of contents sidebar
- Text selection and clipboard copy: v/V for character- and line-wise visual selection (y copies), mouse drag with double-click word and triple-click line, c to copy a code block's raw source, Y to copy the current section's markdown; delivered over OSC 52 (works across SSH/tmux) and a native helper (pbcopy/wl-copy/xclip/xsel/clip.exe)
- File browser mode for exploring directories of markdown files
- 8 built-in color themes with auto dark/light detection, live theme picker that saves to config, plus custom TOML themes
- Presentation mode (split on --- separators), navigate with arrows/space
Expand Down
Loading
Loading