-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: print templates, slide layers and rewrite export function #1513
Conversation
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…into feat/custom-pages
@@ -202,7 +203,8 @@ Options: | |||
- `--range` (`string`): page ranges to export (example: `'1,4-5,6'`). | |||
- `--dark` (`boolean`, default: `false`): export as dark theme. | |||
- `--with-clicks`, `-c` (`boolean`, default: `false`): export pages for every click animation (see https://sli.dev/guide/animations.html#click-animations). | |||
- `--theme`, `-t` (`string`): override theme. | |||
- `--theme` (`string`): override theme. | |||
- `--template`, `-t` (`string`, default: `default`): specify [the print template](/guide/exporting#print-template). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer --type
with hard-coded options like slides
notes
handout
- and let ppl to override them instead of creating arbitrary options. Because we might want to do some special handling for each type - over-generalize it might not be ideal for long term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is OK to allow users to create new print templates. This is because it will be the user/addon's responsibility to handle other options like --with-clicks
or so. Otherwise, users are forced to override one of the 3 templates even if there is no connection between the default one and the overridden one.
About the name of this option, should we change all "print templates" into "print types" or only the CLI flag?
In order to make the handout #1421 pull request work with this code I found that I need to be able to control the scaling factor (zoom) inside SlideWrapper.vue Currently it is retrieved from the front matter
If that would be configurable from a template (e.g. via inject) it would solve the problem that I ran into when implementing a notes template (point 2) where one adjusts the width and height correctly to fit an A4 page but the scale of the content is not adjusted and the content overflows out of the slide. Here is a current draft of the notes template |
About the debugging issue you said in #1421, there is a About the slide scale, we can use |
Co-authored-by: Oliver-Tobias Ripka <[email protected]>
Yes I have also spend some time debugging. I have found that changing the scale factor to 1.5 in
It might have to do with the DPI setting when exporting PDFs, here is a gist for debugging that tries to calculate the width and height according to the DPI (which is hardcoded for now): https://gist.github.com/oripka/36f4589df0fa72ed5758261c0a870264 The page breaks are now correct. The notes need a max-w-full in order to take the whole width. |
Maybe this is related to these known issues (pupeteer and chrome): https://issues.chromium.org/issues/40144973#comment9 I tried this code to determine it dynamically, but I think this is the incorrect DPI for printing, as this is one just displaying the page, not while generating the PDF. In my case it is 96. In the docs I found that the default reference value for PDF should be 72, which does not result in the 1.5 scale. It also contradicts the DPI of 144 that I found using tinkering: https://gist.github.com/oripka/36f4589df0fa72ed5758261c0a870264
Maybe we should provide a sane default, test on Windows, Linux and macOS, in case there are any differences and make it a command line option. |
After some consideration I think I have to rewrite the export logic (this existing one is kind of messed up) Especially I am going to rewrite the |
close #1509
This PR:
--template
or-t
option. In dev mode, the option is called--print-template
../pages/print/*.{vue,ts}
export-notes
sub-command is removed. Use-t notes
instead.-t
was the alias of--theme
, but--theme
is quite uncommon.layouts/slide-top.vue
layouts/slide-bottom.vue