Skip to content

Commit

Permalink
Merge pull request #469 from marp-team/layoutng-printing
Browse files Browse the repository at this point in the history
Allow enabling LayoutNG while PDF conversion via CHROME_LAYOUTNG_PRINTING env
  • Loading branch information
yhatt authored Aug 11, 2022
2 parents a2fd1a9 + 675428a commit 97e14d8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- Allow enabling [LayoutNG](https://www.chromium.org/blink/layoutng/) while PDF conversion via `CHROME_LAYOUTNG_PRINTING` env ([#469](https://github.com/marp-team/marp-cli/pull/469))

### Changed

- Upgrade Marp Core to [v3.3.1](https://github.com/marp-team/marp-core/releases/v3.3.1) ([#468](https://github.com/marp-team/marp-cli/pull/468))
Expand Down
6 changes: 6 additions & 0 deletions src/utils/puppeteer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export const generatePuppeteerLaunchArgs = async () => {
// Enable DocumentTransition API
if (!process.env.CI) args.add('--enable-blink-features=DocumentTransition')

// LayoutNG Printing
if (process.env.CHROME_LAYOUTNG_PRINTING)
args.add(
'--enable-blink-features=LayoutNGPrinting,LayoutNGTableFragmentation'
)

// Resolve Chrome path to execute
if (executablePath === false) {
let findChromeError: Error | undefined
Expand Down
13 changes: 13 additions & 0 deletions test/utils/puppeteer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ describe('#generatePuppeteerLaunchArgs', () => {
}
})

it('enables LayoutNGPrinting and LayoutNGTableFragmentation if defined CHROME_LAYOUTNG_PRINTING environment value', async () => {
try {
process.env.CHROME_LAYOUTNG_PRINTING = '1'

const args = await puppeteerUtils().generatePuppeteerLaunchArgs()
expect(args.args).toContain(
'--enable-blink-features=LayoutNGPrinting,LayoutNGTableFragmentation'
)
} finally {
delete process.env.CHROME_LAYOUTNG_PRINTING
}
})

describe('with CHROME_PATH env in macOS', () => {
let originalPlatform: string | undefined

Expand Down

0 comments on commit 97e14d8

Please sign in to comment.