Skip to content

Conversation

@hugovk
Copy link

@hugovk hugovk commented Nov 17, 2025

Fixes #864.
Replaces and closes #1110.

As commonly requested for the Rust book (at least in rust-lang/book#1756, rust-lang/book#2179, rust-lang/book#2420, rust-lang/book#2700, rust-lang/book#2807, rust-lang/book#3011, rust-lang/book#3283, rust-lang/book#3341, rust-lang/book#3762), don't copy any $ or # prompts when copying console examples.

Unlike #1110 and #1346, this PR also skips the output lines when copying.

For example, copying:

$ echo "Hello, World!"
Hello, World!
$ ls -la
total 64
drwxr-xr-x  5 user  staff  160 Jan 1 12:00 .

Puts only the commands in the clipboard:

echo "Hello, World!"
ls -la

This means you can paste it right away into your terminal and run it without having to edit further.

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a mechanism for ignoring leading characters in a code block

2 participants