Indent missing when pasting from clipboard

Pasting content triggers reformatting by default. See this description when this happens and how to change it.

Observation: Indenting spaces removed while pasting

When pasting content from a clipboard to an AsciiDoc file, the indent (spaces at the beginning of the line) might get lost.

When pasting the contents of the clipboard to a source code block, the indent will be preserved.

Cause: “Reformat on paste” enabled by default

The “Reformat on paste” option is enabled in IntelliJ by default.

Removing spaces from the beginning of a line should not lead to a different rendered output in AsciiDoc. The plugin knows about the exceptions to the rule like source code blocks and verses.

If the plugin removes spaces from the beginning of the line and this leads to a differently formatted output, this is an error in this plugin’s formatter. Open a GitHub issue with a minimal example to reproduce the observed behavior to get it fixed.

Remedy: Change IDE’s configuration

The behavior can be changed via File  Settings…​  Editor  Smart Keys. This will affect all paste operations independent of the file type.

indent missing when pasting

Alternatively the user can disable reformatting of AsciiDoc content via File  Settings…​  Editor  Code Style  AsciiDoc. This will only affect AsciiDoc files, but will disable the explicit reformatting of an AsciiDoc file.