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

feat: browser exporter #1972

Merged
merged 33 commits into from
Dec 17, 2024
Merged

feat: browser exporter #1972

merged 33 commits into from
Dec 17, 2024

Conversation

KermanX
Copy link
Member

@KermanX KermanX commented Dec 3, 2024

This PR introduces a new page on /export as an alternate to the slidev export CLI.

  • A new "export" button is added under the "more options" menu in the navigation bar.
  • When running slidev, the exporting URL will be shown.
  • When running slidev export, a tip will be shown to inform the user to use the exporting UI.

Warning

Both PDF exporting and image capturing don't work well on Firefox. And I don't have a Safari to test.

The Approach

  • For PDF, use the browser's built-in "export to PDF" function.
  • For PPTX/PNGs, the "Screen Capture API" is used.

Screenshots (by 2024/12/5 11:55)

QQ_1733370981699

image

On non-Chromium or chrome<94:

image

Todos

Maybe adding some UI for #1732?

Copy link

netlify bot commented Dec 3, 2024

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit f0304c8
🔍 Latest deploy log https://app.netlify.com/sites/slidev/deploys/67611ad22fa8db000757854b
😎 Deploy Preview https://deploy-preview-1972--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Dec 3, 2024

Open in Stackblitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@1972

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@1972

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@1972

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@1972

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@1972

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@1972

commit: f0304c8

@KermanX KermanX changed the title feat: export UI feat: exporting UI Dec 3, 2024
@KermanX KermanX requested a review from antfu December 5, 2024 04:19
@antfu antfu changed the title feat: exporting UI feat: export from browser Dec 16, 2024
Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

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

Let's have it as experimental and ship it to iterates. I have some UI adjustment in mind but I think the feature wise is very solid already. Thanks a lot for working on it!

@@ -27,6 +27,8 @@ keywords: keyword1,keyword2

# enable presenter mode, can be boolean, 'dev' or 'build'
presenter: true
# enable exporting UI, can be boolean, 'dev' or 'build'
exportingUI: dev
Copy link
Member

Choose a reason for hiding this comment

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

I think just export would be good enough :)

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have an export field in the headmatter:

# export options
# use export CLI options in camelCase format
# Learn more: https://sli.dev/guide/exporting.html
export:
  format: pdf
  timeout: 30000
  dark: false
  withClicks: false
  withToc: false

Copy link
Member

Choose a reason for hiding this comment

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

How about export.browser?

Copy link
Member Author

Choose a reason for hiding this comment

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

export.* are correspondent to the CLI options of slidev export, but there is't a --browser CLI option, which may cause confusion 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I guess that would be fine. We could update the docs mentioning about that. The name exportingUI feels a bit verbose and we don't usually have the concept of UI. Or I don't know if we could call it exporter to differentiate with the CLI export

Copy link
Member

Choose a reason for hiding this comment

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

Or browserExport or browserExporter to be more specific?

@antfu antfu changed the title feat: export from browser feat: browser exporter Dec 17, 2024
@antfu antfu merged commit 0079b79 into slidevjs:main Dec 17, 2024
19 of 20 checks passed
@antfu
Copy link
Member

antfu commented Dec 17, 2024

Let's have it and iterate on the main. I am open for better naming

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

Successfully merging this pull request may close these issues.

2 participants