mkdocs-print-site-plugin icon indicating copy to clipboard operation
mkdocs-print-site-plugin copied to clipboard

Plugin breaks site base URL configuration with Material theme

Open jmlepisto opened this issue 3 years ago • 1 comments

Hi,

First of all, I'm sorry that I can't for sure locate whether this is plugin or Material theme related. However:

When loading any documentation page normally, Material theme reads the site configuration as shown:

image

When loading print_page.html, Material theme receives this incorrect configuration

image

Basically, the base path from the base URL gets dropped out when loading the print page. Here's the mentioned line in Material.

Would you have any idea what's going on here? Here is my configuration:

docs_dir: "doc"
theme:
    name: material
    logo: assets/*****
    favicon: assets/*****
    font: false
    features:
        - navigation.tabs
        - navigation.instant
        - search.highlight
        - content.tabs.link
        - content.code.annotate
    shortcuts:
        help: 191    # ?
        next: 78     # n
        previous: 80 # p
        search: 83   # s

use_directory_urls: false

## The following section defines which markdown extensions to use.
markdown_extensions:
  - tables
  - toc:
      permalink: True
      separator: '_'
  - smarty:
      smart_dashes: False
      smart_quotes: False
      smart_angled_quotes: False
      substitutions:
        left-single-quote: '‚'
  - markdown.extensions.abbr
  - markdown.extensions.admonition
  - markdown.extensions.attr_list
  - markdown.extensions.codehilite:
      guess_lang: false
  - markdown.extensions.def_list
  - markdown.extensions.footnotes
  - markdown.extensions.meta
  - markdown.extensions.toc:
      permalink: true
  - pymdownx.caret
  - pymdownx.critic:
      mode: view
  - pymdownx.details
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.magiclink
  - pymdownx.mark
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde
  - pymdownx.snippets:
      base_path: doc/
  - mkdocs_graphviz
  - markdown_include.include:
      base_path: docs
  - pymdownx.arithmatex:
      generic: true

## Default plugin configuration
plugins:
  - search
  - glightbox:
      effect: fade
      width: 90vw
      height: 90vh
  - kroki:
      ServerURL: https://*****
      FencePrefix: ""
  - print-site:
      add_cover_page: true

extra_javascript:
  - js/mathjax.js
  - js/tablesort.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

copyright: *****

Thanks!

jmlepisto avatar Nov 03 '22 09:11 jmlepisto

Hi @jjstoo !

I haven't inspected this javascript config object before. You say it's incorrect -- is there something that is breaking? Search? I need some more details :)

This plugin doesn't do much on the javascript side of things. Only this:

https://github.com/timvink/mkdocs-print-site-plugin/blob/bcb6d6e7fbea93ca1200f673b4137f8f44823cdf/mkdocs_print_site_plugin/js/print-site.js#L126-L135

It also helps if you specify your mkdocs version + python version + plugin versions + OS. I know the last version of mkdocs 1.4.2 made some changes to urls (see https://github.com/mkdocs/mkdocs/releases)

timvink avatar Nov 03 '22 10:11 timvink