Copy a code block in one click, and wrap long code lines
- New: a Copy button appears when the pointer is over a code block. It copies the code exactly as written, without the ``` fence lines, and shows Copied for a moment. Diagrams have no Copy button, and the button is left out of printing and PDF export.
- New: View ▸ Wrap Long Code Lines. Long lines in code blocks wrap inside the block instead of scrolling sideways. Off by default; the choice is kept for every document.
- New: Settings ▸ Appearance ▸ Reading has a slider for the text column width, with a Default button, and the Wrap long code lines switch. They stay in step with the View menu.
Code blocks are often the part of a document you want to take somewhere else: a command to run, a config to paste, an example to try. Selecting the code by hand is fiddly, so each code block now has a Copy button. It appears at the top right when the pointer is over the block. One click copies the code as it is written in the file, without the fence lines around it, and the button says Copied for a moment.
A long line in a code block used to mean a horizontal scrollbar. If you'd rather see all of it at once, turn on View ▸ Wrap Long Code Lines: long lines wrap inside the block. The setting is off by default, and it changes the page in place without losing your scroll position.
Since 1.6.5 the View menu could make the text column narrower or wider. Settings ▸ Appearance now has a Reading section with a slider for that width, a Default button, and the wrap switch. A change in Settings shows up in the View menu, and the other way around.
Thanks to the reader who asked for the Copy button and the wrap option.