- Create a
.env
file and fill it with your data. Refer to.env.example
for more info. - Make sure you using Node v14 — A bug in Puppeteer on Node 16 prevents this script from working. If you use
nvm
, You can runnvm use
to switch to the correct version. npm run pdf
- ???
- Profit
Note: as of now, the program doesn't log anything to your console. If you want a more verbose output, run node index.js
Make sure all your pages contain a 'next' link. Tools like Docusaurus and GitBook do this by default, but you'll have to do that manually for Notion.
- Docusaurus
NEXT_PAGE_SELECTOR=".pagination-nav__link.pagination-nav__link--next"
- Notion (provided that you've added a 'next' link to each page)
NEXT_PAGE_SELECTOR='.notion-page-content div a:last-of-type[href^="/"]:not([href*="#"])'
- GitBook (causes a timeout for some reason, so broken for now)
NEXT_PAGE_SELECTOR='[data-testid="page.desktopTableOfContents"] + div a:last-child[href^="/"]'