Fallback to Microsoft Edge if not installed Chrome / Chromium #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.