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

[WIP] Export markdown cells as block strings instead of comments #818

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tonyfast
Copy link

@tonyfast tonyfast commented May 21, 2018

This pull request changes how markdown cells are written from the Python exporter. Currently, nbconvert creates Python comments which are not captured by the ast. This change wraps markdown cells in Python block quotes which are included in the ast.

The advantage of this change is that the first markdown cell may be used as both a module docstring and doctest.

screen shot 2018-05-21 at 1 58 22 pm

@mpacer
Copy link
Member

mpacer commented Jun 8, 2018

This is neat. @takluyver do you see any side effects with this?

Could you explain why your example includes assert True?

Could you explain why your example includes jupyter nbconvert --version?

I am asking because I think they are questions that should be answered in the docs accompanying this feature if it is merged. People will benefit from a step by step explanation of what is happening so they can start to think about other ways this idea could be explored.

@tonyfast
Copy link
Author

tonyfast commented Jun 8, 2018

Thanks for having a look at this.

Could you explain why your example includes assert True?

>>> assert True is a doctest, I was just using it aslogic to prove that a doctest was indeed captured from the first markdown cell.

Could you explain why your example includes jupyter nbconvert --version?

This is just a sanity check for the example.

@takluyver
Copy link
Member

I don't see anything obviously wrong with that technically, though I imagine that there'll be a fairly even split of people who like it and people who don't.

What might be neat is to do it with just the first cell (if that's markdown), and convert the rest as ordinary comments. Unfortunately I think that's trickier to do in the template system.

@willingc willingc added the status:work-in-process Do not merge label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants