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

Patch out bootstrap rule forcing black and white printing #3212

Merged
merged 1 commit into from Jan 22, 2018

Conversation

@takluyver
Copy link
Member

@takluyver takluyver commented Jan 15, 2018

A thoroughly ugly hack. Bootstrap forces all text to be black when printing, resulting in a long running issue (#840). I tried to override it with color: inherit !important, but that didn't produce the right results. I can't find any way to tell LESS to remove a rule or act as if it didn't exist. So the only thing I can think to do is to patch the source we get from bootstrap to get rid of the rule entirely.

Frustratingly, it looks like bootstrap is fixing this (getting rid of the rule) for v4, but it's also moving from LESS to SCSS, so we can't easily switch to the new version.

Closes gh-840

@takluyver
Copy link
Member Author

@takluyver takluyver commented Jan 15, 2018

The test failures on Travis appear to be genuine failures from nbval. I just released 0.8, which catches some discrepancies that earlier versions of nbval missed. CC @vidartf .

Loading

Copy link
Member

@Carreau Carreau left a comment

It's been long standing enough. +1 for hackish solution.

Loading

Copy link
Member

@damianavila damianavila left a comment

It is ugly but it is a long standing issue and doing it less hacky way implies a lot of additional complexity.

+1 as well.

Loading

rmed = lines.pop(ix)
print("Removed line", ix, "from bootstrap print.less:")
print("-", rmed)
print()
Copy link
Member

@damianavila damianavila Jan 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this empty print here?

Loading

Copy link
Member Author

@takluyver takluyver Jan 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes a blank line, so the text above is slightly easier to pick out.

Loading

Copy link
Member

@damianavila damianavila Jan 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough 👍

Loading

lines = f.readlines()

for ix, line in enumerate(lines):
if 'Black prints faster' in line:
Copy link
Member

@damianavila damianavila Jan 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is enough specific to patch the proper line, right?

Loading

Copy link
Member Author

@takluyver takluyver Jan 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be. The original file is not very long:

https://github.com/twbs/bootstrap/blob/v3.3.7/less/print.less

Loading

@Carreau Carreau merged commit 0254c8b into jupyter:master Jan 22, 2018
4 checks passed
Loading
@Carreau
Copy link
Member

@Carreau Carreau commented Jan 22, 2018

Thanks both !

Loading

@damianavila
Copy link
Member

@damianavila damianavila commented Jan 31, 2018

@mpacer @takluyver, we need to update the css in the CDN so nbconvert can catch this change.
Will open an issue to track this need.

Loading

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants