orzih / mkdocs-with-pdf

Generate a single PDF file from MkDocs repository.
MIT License
332 stars 77 forks source link

Search bar disappears in HTML when pdf export is enabled #97

Closed pchinery closed 2 years ago

pchinery commented 2 years ago

I'm using the latest mkdocs-material theme and I'm playing with the PDF export (I just got started with it, so I might have missed something).

I have also set the enabled_if_env setting:

plugins:
    - with-pdf:
        enabled_if_env: ENABLE_PDF_EXPORT

Even when ENABLE_PDF_EXPORT is not set, the search bar is removed from the HTML when running mkdocs serve (I'll have to check for mkdocs build though). So I have to comment out the PDF export to make the search bar appear again.

Am I doing something wrong here or is this a technical thing, e.g. because the search bar needs to be removed while rendering the PDF?

pchinery commented 2 years ago

Ok, I have found that one out now. The problem seems to be, that search is a plugin that is enabled by default. But by specifying plugins, this is overridden. This works:

plugins:
    - search
    - with-pdf:
        enabled_if_env: ENABLE_PDF_EXPORT