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

Admonitions not displayed correctly #161

Open
Susi-SiSo opened this issue Oct 30, 2024 · 3 comments
Open

Admonitions not displayed correctly #161

Susi-SiSo opened this issue Oct 30, 2024 · 3 comments

Comments

@Susi-SiSo
Copy link

In the PDF generated with this plugin, the admonitions are not displayed correctly: the icon is displayed over the text (see attached screenshot).

How can I fix this?
Thx.

admonitions-problem-pdf

@Thiti517
Copy link

I had the same type of issue and found a fix in issue #89. Can you check if it works for you?

to summarize...

  1. create a css file (docs/assets/styles/pdf-admonition-fix.css) and fill it with this code (from issue Admonitions do not render in PDF output - mkdocs-material v8.0.2 #89)
@media print {
    /* admonition overrides */

    /* admonition icon */
    .md-typeset :is(.admonition-title,summary):before {
      top: 0.6rem;
      left: 0.6rem;
    }

    /* left border
    .md-typeset :is(.admonition,details) {
      border-left-width: 0.1rem;
      padding: 0rem 0rem 0rem 0rem;
      margin-left: 1rem;
    }

    [dir=ltr] .md-typeset :is(.admonition,details) {
      margin-left: 1rem;
    }

    html .md-typeset :is(.admonition,details)>:last-child {
      margin-left: 0.6rem;
    }
 */
}
  1. add the path to file as a new extra_css entry in mkdocs.yml :
site_name: My Docs
...
extra_css:
  - 'assets/styles/pdf-admonition-fix.css'
...

All credits goes to :

  • cmaurer
  • santaimpersonator

@Susi-SiSo
Copy link
Author

Thank you! I tried it, but it didn't work. This might have to do with my other problem: changes in stylesheets don't apply at all, no matter whether I edit existing stylesheets or add a new one in the templates folder and refer to it from the - with-pdf: attributes in mkdocs.yml. Does anyone have an idea why this is? Thank you!

@Susi-SiSo
Copy link
Author

It did work!!! :-) Thank you! I just had a wrong path to the stylesheet. Great!!

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