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

Add config option to disable print html, css, and icon #1169

Merged
merged 1 commit into from
Sep 22, 2020
Merged

Add config option to disable print html, css, and icon #1169

merged 1 commit into from
Sep 22, 2020

Conversation

rossmacarthur
Copy link
Contributor

@rossmacarthur rossmacarthur commented Mar 19, 2020

This PR adds a new config option which allows you to disable all "print" support.

[output.html.print]
enable = false

Resolves #1177

@Dylan-DPC-zz
Copy link

No issues. We are open to config changes

@ehuss
Copy link
Contributor

ehuss commented Mar 20, 2020

Yea, seems fine.

Just one minor thing, I kinda prefer to avoid double negatives (no-foo=false). Maybe make the option name "print-enabled" with a default of true? Or maybe just print?

Also, I'm just curious, what's your motivation for this?

@DannyBen
Copy link

DannyBen commented Mar 29, 2020

Just one comment about this PR:

I see that it completely disables the "print.css" - is this a good thing to do?
People can still print any page without having to click an HTML-rendered button, and when they do, they should still see a valid CSS specialized for print, without sidebar etc.


To answer the motivation question, at least from my standpoint:

First, I must say It is super great that this feature exists in the first place - I usually want it enabled.

The general use case for disabling it, is to prevent the ease of copyright violation. Sometimes we use mdbook to build a static site, and like most other websites, we do not want to provide a "download the entire site as PDF" option. If you want to read it, you come here.

A more particular use case I have (but with the same principle), is that I want to share a book that is normally only used internally, with someone external for a short period for review. The material is confidential, and should not be downloaded, only read.

@rossmacarthur
Copy link
Contributor Author

@ehuss I changed the config setting to be a subtable. I think this is better because we can add extra settings later if we want and it mirrors the way fold settings are done.

@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2020

I would kinda prefer to avoid adding a new subtable, unless there is some expectation that there will actually be additional keys. If in the future we decide we need additional keys, we can always upgrade it to a subtable. I think a simple print = false would be sufficient.

@ehuss ehuss added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label May 10, 2020
@rossmacarthur
Copy link
Contributor Author

rossmacarthur commented Jun 4, 2020

I don't need this anymore and I don't think I have time to continue working on this PR. Someone else is welcome to branch off this and open a new PR.

@kalindkaria
Copy link

kalindkaria commented Sep 22, 2020

Hi, can I know why this PR is closed without merging the feature of disable printing to master branch?
This is a good feature to have, even I would like to have it in mdBook.
@rossmacarthur and @ehuss any comments?

@ehuss
Copy link
Contributor

ehuss commented Sep 22, 2020

I'll go ahead and merge. The implementation looks good, and I don't feel too strongly about whether or not the config is a separate table. I can imagine extra print options being added in the future.

@ehuss ehuss reopened this Sep 22, 2020
@ehuss ehuss merged commit d1f5ecc into rust-lang:master Sep 22, 2020
@kalindkaria
Copy link

Thanks @ehuss for the quick response. I can now use the following to disable the print option.

[output.html.print]
enable = false

But, the print button at top-right is still visible, yeah I agree on clicking it returns 404, as print.html file doesn't exist now.
Is there a way to even remove that button or this feature is not yet requested for or added?

@ehuss ehuss mentioned this pull request Sep 22, 2020
@ehuss
Copy link
Contributor

ehuss commented Sep 22, 2020

@kalindkaria Oops, thanks for checking! I should have reviewed more closely, there is a ! where it shouldn't have been. Posted #1335 to fix.

@kalindkaria
Copy link

Yes! @ehuss Thanks alot for adding this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to disable the Print button and print.html
5 participants