orzih/mkdocs-with-pdf

<code> tags result in empty boxes

fredlcore opened this issue · 2 comments

I'm having a problem with generating a PDF from my mkdocs documents because text in backticks (resulting in a <code> tag) are displayed as empty boxes. The html files generated in the site directory still look fine:
Bildschirmfoto 2024-11-24 um 11 41 57
However, in the PDF it looks like this:
Bildschirmfoto 2024-11-24 um 11 42 56
It doesn't even seem to be hidden text as selecting the page text and then copy-pasting it to a text editor doesn't show the text there as well.

This is the HTML code that is generated for this part of that file in the site directory:

<ol>
<li>Make sure that your heating system is <a href="supported_heating_systems.html">compatible</a> with BSB-LAN!</li>
<li><a href="https://github.com/fredlcore/BSB-LAN/archive/refs/heads/master.zip">Download</a> and unpack the current BSB-LAN version from the master repository or use <em>git</em> to <a href="https://github.com/fredlcore/BSB-LAN.git">clone</a> the repository.</li>
<li>Navigate to the BSB_LAN folder and rename the following files:<ol>
<li><code>BSB_LAN_custom_defs.h.default</code> to <code>BSB_LAN_custom_defs.h</code></li>
<li><code>BSB_LAN_config.h.default</code> to <code>BSB_LAN_config.h</code>.</li>
</ol>

This is the CSS for the <code> tag in site/css/base.css:

code {
    padding: 2px 5px;
    background-color: rgba(var(--bs-body-bg-rgb), 0.75);
    border: solid 1px var(--bs-border-color);
    color: var(--bs-body-color);
    white-space: pre-wrap;
    word-wrap: break-word;
}

These are the mkdocs.yaml and extra style.css that I'm using, just to show that I don't make any changes to the <code> tag there:

site_name: BSB-LAN
theme: mkdocs
site_url: https://docs.bsb-lan.de
use_directory_urls: false

extra_css:
  - style.css

markdown_extensions:
  - attr_list
  - pymdownx.snippets

plugins:
  - search
  - with-pdf
  - autorefs
  - i18n:
      reconfigure_search: true
      docs_structure: folder
      languages:
          - locale: en
            name: English
            build: true
            default: true
          - locale: de
            name: Deutsch
            build: true
            nav_translations:
                Overview: Überblick
                Quickstart: Schnellstart
                How it works: Wie funktioniert's?
                Supported Heating Systems: Unterstützte Heizungssysteme
                The BSB-LAN Adapter: Der BSB-LAN Adapter
                The BSB/LPB/PPS Bus: Der BSB/LPB/PPS Bus
                How to set it up: Installation
                Installation: Zusammenbauen
                Configuration: Konfiguration
                ChangeLog: ChangeLog
                How to use it: Was kann es?
                BSB-LAN's functions: BSB-LAN Funktionen
                Connect to your Smart Home: Mit dem Smart Home verbinden
                Help!: Hilfe!
                Troubleshooting: Fehlersuche
                FAQ: FAQ
                Wiki: Wiki
                YouTube Tutorials: YoutTube Tutorials
          - locale: fr
            name: Français
            build: true
            nav_translations:
                Overview: Aperçu
                Quickstart: Démarrage rapide
                How it works: Comment ça marche?
                Supported Heating Systems: Systèmes de chauffage pris en charge
                The BSB-LAN Adapter: L'adaptateur BSB-LAN
                The BSB/LPB/PPS Bus: Les BSB/LPB/PS bus
                How to set it up: Installer
                Installation: Assemblage
                Configuration: Configuration
                ChangeLog: ChangeLog
                How to use it: Utiliser
                BSB-LAN's functions: Fonctionnes de BSB-LAN
                Connect to your Smart Home: Connecter à la Smart Home
                Help!: Au secours!
                Troubleshooting: Dépannage
                FAQ: FAQ
                Wiki: Wiki
                YouTube Tutorials: YouTube tutoriels

nav:
  - Overview: README.md
  - Quickstart: quickstart.md
  - How it works:
    - Supported Heating Systems: supported_heating_systems.md
    - The BSB-LAN Adapter: bsb-lan_adapter.md
    - The BSB/LPB/PPS Bus: bus_systems.md
  - How to set it up:
    - Installation: install.md
    - Configuration: configure.md
    - ChangeLog: CHANGELOG.md
  - How to use it:
    - BSB-LAN's functions: using.md
    - Connect to your Smart Home: homeautomation.md
  - Help!:
    - Troubleshooting: troubleshooting.md
    - FAQ: faq.md
    - Wiki: "https://github.com/fredlcore/BSB-LAN/wiki"
    - YouTube Tutorials: "https://www.youtube.com/@BSB-LAN"
  - 🌐:
    - Deutsch: /de/
    - English: /
    - Français: /fr/
h1, h2, h3 {
    color: rgb(84, 162, 225);
}

h1, h2 {
    font-weight: bold;
}

em {
    font-variant: small-caps;
    font-style: normal;
}

body::before {
    background: white;
}

a {
    font-weight: bold;
}

It would be great if you could help me out here because otherwise, your plugin produces really great results and I'd love to use it for my project!

To provide some additional information: The text is actually present, but it's font size must be 1 or something like that because it is just a few pixels high, and it's color is the same as the background, so it's not visible. I have tried running it with the debug_html and verbose options, but the information is too much for me to make any sense of it...

After unsetting and re-enabling all CSS properties, I found the culprit. Adding this into my extra style.css displayed the text within the backticks:

code {
    font-weight: bolder;
}

Interestingly, it has to be bolder. normal or unset does not do the trick.