mkdocs-with-pdf icon indicating copy to clipboard operation
mkdocs-with-pdf copied to clipboard

custom admonition type in PDF

Open cooper-lzy opened this issue 3 years ago • 1 comments

The custom admonition type in PDF cannot be displayed, only the default style is displayed. Please instruct me how to set it? image image

cooper-lzy avatar Jun 01 '21 02:06 cooper-lzy

Hi @cooper-lzy.

Now, mkdocs-material generates style is:

.md-typeset .note>summary:before {
  background-color: #448aff;
  mask-image: var(--md-admonition-icon--note);
  ...
}

But, WeasyPrint not supports mask-image. This plugin set custom css.

To customize the icon, you need to set it yourself in your styles, e.g:

@media print
.md-typeset .note > .admonition-title::before, .md-typeset .note > summary::before {
    background-image:  url("data:image/svg+xml;charset=utf8,%3Csvg viewBox=....") !important;
}

See this polyfill:

https://github.com/orzih/mkdocs-with-pdf/blob/65f36ba383b022627df54db00d885d9e06dedd09/custum_style_src/material-polyfills/src/stylesheets/extensions/_admonition.scss#L62-L76

orzih avatar Jun 07 '21 23:06 orzih