mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Multi-line code blocks copied from browser have ^J (control J) instead of newlines

Open simonmichael opened this issue 1 year ago • 0 comments

Problem

Multi-line code blocks copied from browser have ^J (control J) instead of newlines. This breaks the copy-pasting of multiple shell commands from docs into a terminal.

Steps

  1. Create a code block like

    echo a
    echo b
    
  2. Generate and view the site in a web browser (tested with safari and brave on mac)

  3. Copy the two lines above

  4. Paste into a terminal

Expected: two echo commands, that both run, printing a and b.

Actual: echo a^Jecho b is pasted, only the first echo command runs, only a is printed.

At the time of writing this can also be seen at this code block: https://hledger.org/install.html#build-in-a-source-checkout

Possible Solution(s)

No response

Notes

No response

Version

mdbook v0.4.21

simonmichael avatar Dec 12 '24 20:12 simonmichael