notebook icon indicating copy to clipboard operation
notebook copied to clipboard

JN7 markdown cells mess

Open liquidcarbon opened this issue 10 months ago • 7 comments

Is anyone else experiencing issues with markdown cells where you paste a block of text and it does not show up correctly in the output? It tends to happen more with block quotes and triple quoted code blocks. When you go back to edit the code, your edits also don't appear in the right places. It's rather erratic and hard to reproduce with a specific example. This is happening for me in both Firefox and Edge. I'm under Windows and the notebook is hosted on a Linux server, but I'm pretty sure this was happening locally as well.

Please answer the following questions for yourself before submitting an issue

  • [ x ] I checked the documentation and found no answer
  • [ x ] I checked to make sure that this issue has not already been filed
  • [ x ] I'm reporting the issue to the correct repository

Example input: image

Example output, after pressing Ctrl+Enter: image

And it's actually messed up in the saved ipynb file, too:

  {
   "cell_type": "markdown",
   "id": "553ceae0-fb2c-4207-b52c-a5eca8f99ab8",
   "metadata": {},
   "source": [
    "> Is anyone else experiencing issues with markdown cells where you paste a block of text and it does not show up correctly in the output? It tends to happen more with block quotes and triple quoted code blocks. When you go back to edit the code, your edits also don't appear in the right places. It's rather erratic and hard to reproduce with a specific example. This is happening for me in both Firefox and Edge.\r\n",
    "\r\n",
    "Please answer the following questions for yourself before submitting an issue\r\n",
    "\r\n",
    "    [ x ] I checked the documentation and found no answer\r\n",
    "    [ x ] I checked to make sure that this issue has not already been filed\r\n",
    "    [ x ] I'm reporting the issue to the correct repos\n",
    "```itory\r\n",
    "\r\n",
    "If you have further questions after reading below, please visit the Jupyter Notebook discourse channel (https://discourse.jupyter.org/) and submit your questions there. There are many more people in the Jupyter community that engage on that c repository.\r\n",
    "\r\n",
    "We recommend that you check out JupyterLab (https://github.com/jupyterlab/jupyterlab), Jupyter's next generation Notebook interface.\r\n",
    "\r\n",
    "Here, we're looking for specific bugs in the Jupyter Notebook codebase. If you think you've identified such a bug, you can continue opening your issue here. We'd appreciate if you include as much detail as possible, such as links to the offending code, snapshots of the UI issue, code blocks with your c\n",
    "```onsole logs, etc."
   ]
  },

liquidcarbon avatar Aug 07 '23 17:08 liquidcarbon

Thank you @liquidcarbon for opening this issue! Something like this, dealing with Windows line endings, has been previously reported in JupyterLab https://github.com/jupyterlab/jupyterlab/issues/14752.

RRosio avatar Aug 08 '23 16:08 RRosio

Since Notebook 7 is based on JupyterLab components, this will likely have to be fixed in JupyterLab first and then pulled in Notbeook 7.

jtpio avatar Aug 09 '23 05:08 jtpio

This is a problem with Windows, NOT Jupyter Lab. Whether it can be controlled within VsCode is another thing.

For example, take ANY code in VsCode with LF line endings (it can be Python code, a Jupyter notebook, etc) and copy several lines of the code then paste it into the online service https://www.soscisurvey.de/tools/view-chars.php and choose Show me the characters button, it will show you CRLF line endings even though your code within VsCode has LF line endings.

kuhlaid avatar Sep 08 '23 19:09 kuhlaid

@kuhlaid if CRLF problem is all this really is, it has been solved for a good decade in the old Jupyter notebook and older JupyterLab and every other tool crossplatform tool, but somehow it's a problem in the new JN

liquidcarbon avatar Sep 11 '23 16:09 liquidcarbon

I have the same issue - running Jupyter from a Docker container on a Linux VM, opening with Chrome on Windows:

Example input: image

Output: image

Even worse, when I opened the notebook again a few days later, I found that the input cell text was broken as well !

Copying the cell contents to https://www.soscisurvey.de/tools/view-chars.php I can see the line endings are CRLF.

I have Jupyter Notebook v7.0.3 installed.

I hope this will be solved soon.

OrianeN avatar Oct 02 '23 12:10 OrianeN

I can confirm this problem. It is reported in jupyterlab: https://github.com/jupyterlab/jupyterlab/issues/14752

And indeed is related to \r\n line ending problem. It seems to be started all in summer 2023. Maybe a git bisect will reveal the revision where this happended. At first only the rendering is affected. And I most oftenly find the issue with tripple quotes for code also. And when reopening the file then the markdown source is even missing some input.

kiliansinger avatar Feb 12 '24 19:02 kiliansinger

I made a PR it should be fixed in the coming bug fix.

kiliansinger avatar Feb 14 '24 16:02 kiliansinger