Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin breaks site base URL configuration with Material theme #77

Open
jjstoo opened this issue Nov 3, 2022 · 1 comment
Open

Plugin breaks site base URL configuration with Material theme #77

jjstoo opened this issue Nov 3, 2022 · 1 comment

Comments

@jjstoo
Copy link

jjstoo commented Nov 3, 2022

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!

@timvink
Copy link
Owner

timvink commented Nov 3, 2022

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:

function remove_material_navigation() {
// Remove left sidebar on print page
remove_element_by_classname('md-sidebar--primary')
// Remove tabs navigation on print page
remove_element_by_classname('md-tabs')
// Remove search
remove_element_by_classname('md-search')
}

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants