Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line breaks for multi-line comments in Markdown cells are broken (interactive Python) #9620

Open
1 of 2 tasks
xareelee opened this issue Apr 7, 2022 · 3 comments
Open
1 of 2 tasks
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window

Comments

@xareelee
Copy link

xareelee commented Apr 7, 2022

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

In a .py file, I wrote a markdown cell with python strings (multiple line comments):

#%% [markdown]

"""
# H1 Title

description 1

- item 1
    - item 2
- item 3

description 2

- item 4
    - item 5
- item 6
"""

I run the cell (ctrl + enter), but it shows:

Screen Shot 2022-04-07 at 11 15 05

The line breaks and the indentation of list items are incorrect.

Additionally, writing code block within python comments

#%% [markdown]

"""
Writing code blocks in markdown:

```shell
# Comment 1
$ ls 

# Comment 2
$ ls -lh
```
"""

shows no line breaks:

Screen Shot 2022-04-07 at 12 09 27

VS Code Version

1.66.0

Jupyter Extension Version

v2022.3.1000901801

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.10.2

Language Extension Version (if applicable)

v2022.4.0

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

@xareelee xareelee added bug Issue identified by VS Code Team member as probable bug needs-triage labels Apr 7, 2022
@rchiodo
Copy link
Contributor

rchiodo commented Apr 7, 2022

Thanks for the issue. Looks like we're removing the linebreaks when parsing the multiline comment.

Single line comments should work though.

# %% [markdown]
#
#
# # H1 Title
#
# description 1
#
# - item 1
#    - item 2
# - item 3
#
# description 2
#
# - item 4
#    - item 5
# - item 6

@greazer greazer changed the title Line breaks in Markdown cells are broken (interactive Python) Line breaks for multi-line comments in Markdown cells are broken (interactive Python) Apr 7, 2022
@greazer greazer added the interactive-window Impacts interactive window label Apr 7, 2022
@rebornix rebornix assigned rebornix and amunger and unassigned rebornix and amunger Aug 11, 2022
@rebornix rebornix removed the interactive-window Impacts interactive window label Aug 15, 2022
@rebornix
Copy link
Member

This is not IW specific but a generic markdown cell rendering issue.

@DonJayamanne
Copy link
Contributor

This is an IW issue, as the spaces are trimmed or something is wrong with the markdown.

  • Step 1 - Create the following markdown cell in a notebook and check the renderered content
# H1 Title

description 1

- item 1
    - item 2
- item 3

description 2

- item 4
    - item 5
- item 6
  • Step 2 - Now run the above code as a cell in IW and the check the markdown output
  • The markdown outputs look very different, when in fact they must be identical,
  • Step 3: Create a cell in a notebook and add the above content and ensure the first line starts with %%markdown cell magic, and check the output, notice how the markdown is as expected
  • In all cases the markdown is rendered correctly except when executed in IW, (even works in notebooks)
    hence the problem lies with the markdown text sent to the kernel by the IW code

@DonJayamanne DonJayamanne added interactive-window Impacts interactive window and removed notebook-markdown labels Aug 15, 2022
jeremymanning added a commit to jeremymanning/chatify that referenced this issue Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window
Projects
None yet
Development

No branches or pull requests

7 participants