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

How to increase font-size for text and headings?

Open alexander-matthiesen opened this issue 4 years ago • 7 comments

How can the font size be increased globally? Especially the headings are pretty small when there are h5 or h6 headings.

alexander-matthiesen avatar Jan 27 '21 13:01 alexander-matthiesen

Hi @alexander-matthiesen.

Are you using a material theme? See material theme's default.

e.g. try adding the following to your custom CSS:

@media print {
  .md-typeset {
    font-size: 0.8rem !important;
  }
  .md-typeset h4,
  .md-typeset h5,
  .md-typeset h6 {
    font-size: 1rem;
  }
}

orzih avatar Jan 28 '21 02:01 orzih

Got the exact opposite : everything is way too big except TOC. Tried extra-sass plugin from this sample repo without luck https://github.com/orzih/mkdocs-with-pdf/tree/master/samples/mkdocs-material Bildschirmfoto 2021-05-09 um 20 37 32

giswa avatar May 09 '21 18:05 giswa

FInally got it all good using the docker images provided here : dockerfile (I was using image from dockerhub : hellt/mkdocs-material-apline-docker which uses python2.7 )

giswa avatar May 10 '21 18:05 giswa

I seem to have the same problem. It simply does not overwrite any of the font sizes with the custom CSS styles.scss in a folder templates in mkdocs root.

DanielFichtner avatar Jan 28 '22 14:01 DanielFichtner

I have the same problem. Fonts are too big. I tried the solution suggested by @orzih above, it didn't help. I also tried the suggestion in the documentation to enable debug output and examine the HTML. But I am not sure what I am looking for.

Tip: setting the debug_html option to true to get the generated html that is passed to weasyprint can help you determine the html tags, classes or identifiers you want to modify in your stylesheet.

I can see in the debug output that my styles.scss was evaluated, but to no effect. @DanielFichtner did you find a solution?

StefanSchroeder avatar May 05 '22 18:05 StefanSchroeder

@StefanSchroeder well I just went directly into the source code and edited everything I needed in there. It's all still open source :) It's a little bit more complicated but if you know your way around you get it done:

DanielFichtner avatar May 10 '22 05:05 DanielFichtner

@DanielFichtner NIce. I actually was able to fix the font adjustment using a stylesheet only. It took me a while to figure out the right tag-names, appropriate units and filename for the stylesheet. For the record: I created a folder "templates" on the top-level that contains a file "styles.scss" that contains CSS.

Works on my machine.

The CSS:

@media print { .md-typeset { font-size: 9pt !important; } .md-typeset h1, .md-typeset h2, .md-typeset h3, .md-typeset h4, .md-typeset h5, .md-typeset h6 { font-size: 12pt; } }

StefanSchroeder avatar May 10 '22 07:05 StefanSchroeder