Skip to content

Conversation

@axelson
Copy link
Contributor

@axelson axelson commented Mar 8, 2025

When given text like:

iex> existing_zipper = ("""
...> IO.inspect("Hello, world!")
...> IO.puts("abc")
...> """

We need to ensure that the newlines are preserved in the selectable text. With this PR ex_doc will allow us to copy the text:

existing_zipper = ("""
IO.inspect("Hello, world!")
IO.puts("abc")
"""

Without this PR, ex_doc copies the text:

existing_zipper = ("""IO.inspect("Hello, world!")IO.puts("abc")"""

and this breaks when pasted into iex with an error like:

** (SyntaxError) invalid syntax found on iex:1:23:
    error: heredoc allows only whitespace characters followed by a new line after opening """

Fixes elixir-lang/ex_doc#2096

When given text like:
```
iex> existing_zipper = ("""
...> IO.inspect("Hello, world!")
...> IO.puts("abc")
...> """
```

We need to ensure that the newlines are preserved in the selectable text
@josevalim josevalim merged commit de29729 into elixir-makeup:master Mar 9, 2025
2 checks passed
@josevalim
Copy link
Collaborator

💚 💙 💜 💛 ❤️

@axelson axelson deleted the newlines-in-iex-prompt branch March 9, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heredoc newlines are removed when copying and pasting

2 participants