Skip to content

Commit

Permalink
Merge branch 'main' into lang-directive
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Oct 28, 2023
2 parents 45b4744 + d0520cc commit 8a14d41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- Upgrade Marp Core to [v3.9.0](https://github.com/marp-team/marp-core/releases/v3.9.0) ([#557](https://github.com/marp-team/marp-cli/pull/557))
- Upgrade dependent packages to the latest versions ([#557](https://github.com/marp-team/marp-cli/pull/557))

### Fixed

- Enable PNG image transparency ([#555](https://github.com/marp-team/marp-cli/issues/555), [#556](https://github.com/marp-team/marp-cli/pull/556))

## v3.3.1 - 2023-10-01

### Fixed
Expand Down
13 changes: 12 additions & 1 deletion src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ export class Converter {
await render()
await page.emulateMediaType('print')

if (opts.type === ConvertType.png) {
// Enable transparency
await page.addStyleTag({
content: ':root,body { background:transparent !important; }',
})
}

const screenshot = async (pageNumber = 1) => {
const clip = {
x: 0,
Expand All @@ -405,7 +412,11 @@ export class Converter {
type: 'jpeg',
})

return await page.screenshot({ clip, type: 'png' })
return await page.screenshot({
clip,
omitBackground: true,
type: 'png',
})
}

if (opts.pages) {
Expand Down

0 comments on commit 8a14d41

Please sign in to comment.