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

Download PDF missing with mkdocs-material 8 #88

Open
fottsia opened this issue Nov 29, 2021 · 4 comments
Open

Download PDF missing with mkdocs-material 8 #88

fottsia opened this issue Nov 29, 2021 · 4 comments

Comments

@fottsia
Copy link

fottsia commented Nov 29, 2021

Hi, with the new mkdocs-material 8.0.0, the "download PDF" link at the footer no longer shows up.
Thank you for this plugin, much appreciated!

@hpsems
Copy link

hpsems commented Jan 12, 2022

Same Problem here. Have you found a solution or workaround yet?

@nicolasb29
Copy link

Hi,

It seems that css class changed from md-footer-copyright to md-copyright

https://github.com/orzih/mkdocs-with-pdf/blob/f2e78d8c8ecb505636ba31a4830646038a78accd/mkdocs_with_pdf/themes/material.py

@nicolasb29
Copy link

Hi,

I have found a workaround : add a file pdf_event_hook.py (experimental feature) with this contant

import logging

from bs4 import BeautifulSoup
from mkdocs.structure.pages import Page


def inject_link(html: str, href: str,
                page: Page, logger: logging) -> str:

    logger.info(f'(hook on inject_link: {page.title})')
    soup = BeautifulSoup(html, 'html.parser')
    footer = soup.select('.md-copyright')
    nav = soup.find(class_='md-header-nav')
    if footer and footer[0]:
        container = footer[0]

        container.append(' ... ')
        a = soup.new_tag('a', href=href, title='PDF',
                         download=None, **{'class': 'link--pdf-download'})
        a.append('download PDF')

        container.append(a)

        return str(soup)

    return html

@samzong
Copy link

samzong commented May 8, 2022

#88 (comment)

thanks a lot , it's working for me.

samzong added a commit to samzong/mkdocs-with-pdf-support-material-v8 that referenced this issue May 8, 2022
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

4 participants