Skip to content

Docusaurus to PDF

Actions
Extracts a PDF from a Docusaurus documentation URL
v1
Latest
Star (0)

Docusaurus to PDF

This repository allows you to generate a PDF from a Docusaurus documentation URL using Docker or a GitHub Actions workflow.

Usage

Using Docker

You can run the tool locally using Docker:

docker run --rm -v $(pwd):/pdf -e DOCS_URL="https://your-docusaurus-site.com" ghcr.io/vaggeliskls/docusaurus-to-pdf:latest

Using GitHub Actions

You can integrate this tool into your GitHub Actions workflow.

Example Workflow:

name: "Generate PDF from Docusaurus"

on:
  push:

jobs:
  generate-pdf:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Run Docusaurus to PDF Action
        uses: vaggeliskls/docusaurus-to-pdf@v1
        with:
          DOCS_URL: "https://your-docs-url.com"

      - name: Upload PDF Artifact
        uses: actions/upload-artifact@v4
        with:
          name: Docusaurus-PDF
          path: "./docs-to-pdf.pdf"

Customization

You can customize the PDF generation with the following environment variables:

Variable Description Default Value
DOCS_URL Docusaurus documentation URL (required) N/A
PUPPETEER_ARGS Additional Puppeteer arguments --no-sandbox
EXCLUDE_URLS URLs to exclude from the PDF N/A
EXCLUDE_PATHS Path patterns to exclude N/A
COVER_TITLE Title for the PDF cover "Documentation"
CONTENT_SELECTOR CSS selector for main content "article"
PAGINATION_SELECTOR CSS selector for pagination elements "a.pagination-nav__link.pagination-nav__link--next"
EXCLUDE_SELECTOR CSS selector for elements to exclude ".margin-vert--xl a,[class^='tocCollapsible'],.breadcrumbs,.theme-edit-this-page"
EXTRA_ARGS Additional arguments for docs-to-pdf command N/A
OUTPUT_PDF_FILENAME Custom name for the generated PDF file "docs-to-pdf.pdf"

License

This project is licensed under the MIT License.

References

Docusaurus to PDF is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Extracts a PDF from a Docusaurus documentation URL
v1
Latest

Docusaurus to PDF is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.