simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.15k stars 110 forks source link

bug: Puppeteer reports a weird warning #247

Open thunderhunt opened 1 year ago

thunderhunt commented 1 year ago

Context:

Describe the bug:

When you run to get the pdf of an MD file, some weird warning lands on the screen. check below. Puppeteer old Headless deprecation warning: In the near future headless: true will default to the new Headless mode for Chrome instead of the old Headless implementation. For more information, please see https://developer.chrome.com/articles/new-headless/. Consider opting in early by passing headless: "new" to puppeteer.launch() If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.

simonhaenisch commented 1 year ago

Do you mean the message shows up in the terminal or in the generated PDF?

thunderhunt commented 12 months ago

@simonhaenisch , Its showed up in yellow in terminal

FelipeJz commented 10 months ago

Same here

simonhaenisch commented 10 months ago

This will resolve itself soon enough with the next major version of puppeteer, I assume.

FelipeJz commented 10 months ago

This happens because there is a new headless implementation, the previous one will be soon deprecated, the default option in md-to-pdf is still using it, this issue is resolved by changing the headless option to "new", it works fine, so is a simple update.

Temporary fix

const pdf = await mdToPdf(
      { content: "" },
      {
        launch_options: {
          headless: "new",
        },
      }
    );