adrienbrignon / mkdocs-exporter

⚡ The fastest and most configurable plugin for MkDocs, allowing seamless export of individual pages and/or entire documentation as PDF documents.
https://adrienbrignon.github.io/mkdocs-exporter/
MIT License
83 stars 9 forks source link

The path to download pdf is incorrect if configure use_directory_urls to false #44

Open lyx10101010 opened 1 month ago

lyx10101010 commented 1 month ago

Hello! If the use_directory_urls configuration is set to false, the relative path of the PDF becomes incorrect. If I remove the use_directory_urls option and use the default configuration, there are no issues.

For example, if there is a file named docname.md located in docs/sub/docname.md, the generated link is https://[host:port]/docs/faq/docname.pdf, but it should be https://[host:port]/docs/faq/sub/docname.pdf.

use_directory_urls: false

repo_name: faq
repo_url: https://[host.port]/gateway/docs/faq

theme:
  name: material
  features:
    - navigation.indexes
    - navigation.sections
    - navigation.tabs
    - navigation.top
    - navigation.tracking
    - search.highlight
    - search.suggest
    - toc.follow
    - content.code.copy
    - content.code.select
    - content.code.annotate
  palette:
    - media: "(prefers-color-scheme)"
      primary: teal
      accent: teal
      toggle:
        icon: material/brightness-auto
        name: Switch to light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: teal
      accent: teal
      toggle:
        icon: material/brightness-7
        name: Switch to dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: teal
      accent: teal
      toggle:
        icon: material/brightness-4
        name: Switch to system preference
  font:
    text: Roboto
    code: Roboto Mono
  favicon: assets/faq.png
  icon:
    logo: logo
    repo: fontawesome/brands/square-gitlab

plugins:
  - progress
  - search:
      separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
  - tags:
      tags_file: tags.md
  - literate-nav:
      nav_file: summary.md
  - exporter:
      formats:
        pdf:
          concurrency: 32
          enabled: !ENV [MKDOCS_EXPORTER_PDF_ENABLED, true]
      buttons:
        - title: Download as PDF
          icon: material-file-download-outline
          enabled: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.enabled
          attributes: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.attributes