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

Jupytext failed to recognise py file where md text ends up with ''' #307

Closed
pytkr opened this issue Jul 26, 2019 · 1 comment
Closed

Jupytext failed to recognise py file where md text ends up with ''' #307

pytkr opened this issue Jul 26, 2019 · 1 comment
Milestone

Comments

@pytkr
Copy link

pytkr commented Jul 26, 2019

Hi, I find .py file can be recognised and automatically generate corresponding .ipynb and .md files using jupyter notebook with Jupytext, but I cannot successfully make following Code 4 md cell correctly recognised as a md cell, and it just ruined the following cells into one cell where filled with {{{ and }}}:

Code 1 (OK): this will show normally as 1 code cell

# abcd
print('hello world')

Code 2 (OK): this will be recognised as 1 md cell and 1 code cell

# abcd

print('hello world')

Another syntex with the same effect

# {{{ {"cell_type": "markdown"}
# abcd
# }}}
print('hello world')

Or

# {{{ {"cell_type": "markdown"}
# abcd
# }}}

print('hello world')

Code 3 (OK): this will be recognised as 1 md cell and 1 code cell

# abcd'''

print('hello world')

Code 4 (Failed): this will be recognised as 1 cell, just like abcd''' }}} print('hello world')

{{{ {"cell_type": "markdown"}

abcd'''

}}}

print('hello world')

I don't know whether this a md issue or jupytext one, and hope this can be fixed.
Thanks!

@pytkr pytkr changed the title Jupytext failed to recognise py file where md text ends up with ''' and of slide mode Jupytext failed to recognise py file where md text ends up with ''' Jul 26, 2019
@mwouts
Copy link
Owner

mwouts commented Aug 14, 2019

Hello @pytkr , thanks for the detailed report! Sure we'll have to fix that.

I think that what happens is that the detection of strings (in stringparser.py) is not aware of the single line comment (# for Python). I am currently not in a position to propose a fix for this, but I will certainly have a look at this in early September.

@mwouts mwouts added this to the 1.2.2 milestone Aug 30, 2019
@mwouts mwouts closed this as completed in 66dbe50 Sep 1, 2019
mwouts added a commit that referenced this issue Sep 1, 2019
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

No branches or pull requests

2 participants