vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

feat: improve printing experience.

Open 7086cmd opened this issue 1 year ago • 3 comments

In some cases, we may need to print documents as PDFs, using mdbook as an example. While certain components can be omitted during printing, there are situations where we might want to retain them. To address this, I am introducing an option to manage these components.

In the current implementation, I use the important key to emphasize hiding certain elements, which may lead to unintended side effects. I plan to remove these commands to avoid such issues.

Before

Before Image

After

After Image

With the removeExtraElementsInPrint option in DefaultTheme.Config, users can decide whether to keep or omit specific components during printing. Additionally, I have modified the dark mode switch function to automatically switch to light mode when the beforeprint event is triggered.


Let me know if any further changes are needed!

7086cmd avatar Jul 14 '24 07:07 7086cmd

So strange. Local code are formatted, but online repo reported errors.

7086cmd avatar Jul 19 '24 18:07 7086cmd

You seem to be using different prettier version. Try re-running pnpm install. Then pnpm format.

brc-dd avatar Jul 19 '24 18:07 brc-dd

@brc-dd It works. Thanks!

7086cmd avatar Jul 19 '24 23:07 7086cmd