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-highlight corrupt print #2666

Closed
yoshigev opened this issue Dec 3, 2020 · 3 comments · Fixed by #2668
Closed

Line-highlight corrupt print #2666

yoshigev opened this issue Dec 3, 2020 · 3 comments · Fixed by #2668

Comments

@yoshigev
Copy link

yoshigev commented Dec 3, 2020

Information:

  • Prism version: latest from the download page
  • Plugins: toolbar, copy-to-clipboard, line-highlight
  • Environment: Browser (chrome)

Description
I'm using line-highlight, and when printing the page, the code is partially hidden.

This is caused because the transparent background of the line-highlight class is printed as opaque white.

Workaround
Set the style of the line-highlight class like this:

.line-highlight {
    -webkit-print-color-adjust: exact;
}

This works in Chrome. I didn't test with other browsers.

Example

<pre class="code-toolbar" data-line="4-8"><code class='language-json'>{


  "channelDat`": {
    "foo": {
      "bar": "bar"
    }
  }
}</code></pre>

Produces the following when printing the page:
image

@RunDevelopment
Copy link
Member

Cannot reproduce.

Here is a minimal example project with your configuration and code. I tested it on Chrome 86 and everything works.

This seems like a problem with the specific CSS used on your site.

@yoshigev
Copy link
Author

yoshigev commented Dec 3, 2020

Hi @RunDevelopment.
Thanks for the quick reply.

I forgot to mention on my original post that it only happens when de-selecting the "Background graphics" checkbox on the Print options.
I just tried it with your project and it reproduced (using Chrome 86):
image

@RunDevelopment
Copy link
Member

Sorry. I thought you meant "printed as opaque white" as rendered and literally printed. My bad.

I'll make a PR with your fix.

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

Successfully merging a pull request may close this issue.

2 participants