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

Improve Puppeteer conversion on WSL environment #176

Merged
merged 10 commits into from
Nov 3, 2019
Merged

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Nov 3, 2019

Recently WSL environment became to need --no-sandbox option to execute Windows Chrome. (for PDF / PPTX conversion through Puppeteer)

I've improved the initialization of Puppeteer, to work some conversions on WSL again.

Resolves #175 and marp-team/marp-vscode#89.

//
// But it causes invalid rendering in Marp's `inlineSVG` mode. So we override
// `--disable-features` option to prevent disabling BGPT.
const args = new Set<string>(['--disable-features=TranslateUI'])
Copy link
Member Author

Choose a reason for hiding this comment

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

The default arguments by Puppeteer is defined --disable-features=BlinkGenPropertyTrees, but rendering of Marp's inline SVG mode requires this feature to prevent glitch. Now we've enabled BGPT forcely because PDF conversion on WSL may return empty slides.

: `data:text/html;base64,${baseFile.buffer!.toString('base64')}`
const uri = await (async () => {
if (tmpFile) {
if (isWSL()) return `file:${await resolveWSLPath(tmpFile.path)}`
Copy link
Member Author

Choose a reason for hiding this comment

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

Puppeteer is using Windows Chrome, so we have to resolve the file path for WSL if using tmpfile while conversion by enabling --allow-local-files.

@yhatt yhatt merged commit 642d1a3 into master Nov 3, 2019
@yhatt yhatt deleted the puppeteer-wsl branch November 3, 2019 17:34
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.

I can't convert to pdf or pptx on Windows Subsystem for Linux
1 participant