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

Don't remove empty cells by default #784

Merged
merged 1 commit into from Aug 29, 2018

Conversation

Projects
None yet
3 participants
@mgeier
Copy link
Contributor

mgeier commented Mar 21, 2018

Since there was no real response to #720, I thought I'll try it with a pull request ...

This PR restores the sane behavior of not removing stuff without the user wanting to remove stuff.

It also fixes the docstring so if people actually want to remove stuff, they can learn how to do that.

@mgeier mgeier force-pushed the mgeier:keep-empty-cells branch from 8595f56 to 308fb29 Mar 21, 2018

@mgeier

This comment has been minimized.

Copy link
Contributor Author

mgeier commented Apr 25, 2018

Ping?

1 similar comment
@mgeier

This comment has been minimized.

Copy link
Contributor Author

mgeier commented May 30, 2018

Ping?

@tillahoffmann
Copy link
Contributor

tillahoffmann left a comment

I'm happy to merge this to have more canonical default behaviour.

> jupyter nbconvert --RegexRemovePreprocessor.enabled=True \

This comment has been minimized.

@tillahoffmann

tillahoffmann Aug 12, 2018

Contributor

The default value for the enabled flag appears to be False. We should either override the default value for the RegexRemovePreprocessor or keep the --RegexRemovePreprocessor.enabled=True flag. Or is a preprocessor enabled automatically if one of its attributes (patterns) is set?

This comment has been minimized.

@mgeier

mgeier Aug 13, 2018

Author Contributor

@tillahoffmann Thanks for the review!

I'm not quite sure, but I think the preprocessor is enabled by default because of this:

@property
def default_config(self):
c = Config({
'RegexRemovePreprocessor': {
'enabled': True
},
'TagRemovePreprocessor': {
'enabled': True
}
})

I don't care if it is enabled or not, as long as it doesn't remove stuff by default.

modify the patterns traitlet. For example, execute the following command
to convert a notebook to html and remove cells containing only whitespace:
to convert a notebook to html and remove cells containing only whitespace::

This comment has been minimized.

@tillahoffmann

tillahoffmann Aug 12, 2018

Contributor

Small typo of an extra : here.

This comment has been minimized.

@mgeier
The first command line argument enables the preprocessor and the second
sets the list of patterns to '\\s*\\Z' which matches an arbitrary number
The command line argument
sets the list of patterns to ``'\\s*\\Z'`` which matches an arbitrary number

This comment has been minimized.

@tillahoffmann

tillahoffmann Aug 12, 2018

Contributor

Are single back ticks sufficient here?

This comment has been minimized.

@mgeier

mgeier Aug 13, 2018

Author Contributor

I tried it, and apparently not.

Sphinx allows to customize the formatting of single backticks, but it is apparently not configured for typewriter text (and I also don't think it would be a good idea to do so).

@mgeier

This comment has been minimized.

Copy link
Contributor Author

mgeier commented Aug 28, 2018

@tillahoffmann Is there anything else you need me to do?

@tillahoffmann

This comment has been minimized.

Copy link
Contributor

tillahoffmann commented Aug 28, 2018

Happy for this PR to be merged. As an aside, thank you for the detailed Sphinx explanation.

@blink1073

This comment has been minimized.

Copy link
Member

blink1073 commented Aug 29, 2018

Thanks!

@blink1073 blink1073 added this to the 5.4 milestone Aug 29, 2018

@blink1073 blink1073 merged commit 4d9fe03 into jupyter:master Aug 29, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mgeier mgeier deleted the mgeier:keep-empty-cells branch Aug 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment