Markdown cell insert \r after a paste in a notebook running under WSL 2

I use WSL that runs jupyterhub via systemd. Since it’s a Windows laptop, I also use a browser (chrome) running in Windows. When I do a copy/paste of some text from a browser into a cell, then try to modify that text - specifically, if I try to insert/copy paste some other text in a sentence within that previously pasted text, the output becomes erratic.

For example.

This is what the text “looks like” in the browser:

In this post, you will learn about the structure of large language models and how it works. In particular, you will know:

  • What is a transformer model
  • How a transformer model reads text and generates output
  • How a large language model can produce text in a human-like fashion.

This is what the text looks like when rendered in the markdown cell:

In this post, you will learn about the structure of large language models and how it works. In particular, you willno

  • w:

What is a transformer -

  • model How a transformer model reads text and generates -
  • output How a large language model can produce text in a hum-like

fashion.

When reviewing the ipynb file with an editor, I note that the pasting embeds a \r

character. This seems to throw everything off.

Anyone have any idea why this is happening and what can be done to resolve this issue?

Sorry, I just found this when I was looking for recent example reports.
You seemed to realize it has to do with the line endings and it was fixed. I’ll link to more explanation and details below for others that may find this trying to sort out what could be happening.

Resources with additional details: