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

Fallback to Microsoft Edge if not installed Chrome / Chromium #292

Merged
merged 9 commits into from
Oct 17, 2020

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Oct 10, 2020

Marp CLI will find out the executable path of Microsoft Edge for exporting slide deck into PDF, PPTX, and images if not found out Google Chrome and Chromium via chrome-launcher module. Chromium-based Edge is generally pre-installed to Windows 10 so Marp CLI users in Windows do no longer need to install extra Chrome browser just for exporting PDF.

How to find Microsoft Edge binary

Unlike Google Chrome, Microsoft is not to provide a reusable module for resolving executable path of Edge. But we can refer to the code of Edge tools for VS Code. It also has made by Microsoft so its logic is sufficiently reliable.

I implemented an original Edge finder similar to Chrome finder by Google. Finding paths are based on vscode-edge-devtools, and the priority simulates Google Chrome finder (Prefer canary -> dev -> beta -> stable). In Windows, Marp CLI finds out the binary from 3 different locations, Program files, Program files (x86), and local app data directory (Probably Edge for Windows has different path by environment).

Linux and WSL

Edge for Linux is not yet released at the moment so the fallback is normally not working on Linux.

However, we can fallback to Edge binary for Windows as same as Chrome finder if Marp CLI is running on WSL. This fallback is only working on WSL1. As I mentioned at #264, be aware Chromium-based browser for Windows over WSL2 is still not working.

In this PR, I've also improved how to create temporary HTML for conversion that has optimized to WSL. Marp CLI will use more reliable conversion setting when using custom path for Linux Chrome within WSL via CHROME_PATH env.

Closes #199 and #288.

@yhatt yhatt linked an issue Oct 10, 2020 that may be closed by this pull request
@yhatt yhatt merged commit d945125 into master Oct 17, 2020
@yhatt yhatt deleted the fallback-to-edge branch October 17, 2020 12:42
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.

Better custom Chrome path support in WSL Fallback to Microsoft Edge if not installed Chrome
1 participant