Copy button in documentation copies prompt and result along with code

Proud Julia user here, but I am quite surprised that copy buttons in, for example, docs for joinpath gives such result, e.g.

julia> joinpath(["/home/myuser", "example.jl"])
"/home/myuser/example.jl"

To me it makes much more sense if the copy button only copies the code, e.g.

joinpath(["/home/myuser", "example.jl"])

Is this by design, or is this an oversight?

The REPL has a feature called prompt pasting that ignores the julia> prompt and only interprets the statement when this string pasted into the REPL.

1 Like

Thanks! and…

This feature does not work on the standard Windows command prompt due to its limitation at detecting when a paste occurs.

That’s … not so great …

A common statement when Windows is involved.

5 Likes

Don’t use Cmd. PowerShell is still bad but many times better. To rice it, you can use it in the Windows Terminal, which is actually half decent.

Prompt pasting doesn’t work anywhere on Windows for me, not in the new Terminal with Powershell or anything else.

Anyway, it’s an unnecessary workaround for the problem reported by the OP.

1 Like