orzih / mkdocs-with-pdf

Generate a single PDF file from MkDocs repository.
MIT License
326 stars 76 forks source link

How to put string in `cover_title` or `cover_subtitle` so that it split lines. #47

Open kittiu opened 3 years ago

kittiu commented 3 years ago

For example, I wan the title to be,

This is document
for
Company A

And not This is document for Company A

I try everything, using |, \n, \newline, \n\n, 2 break lines,
, and they are not working.

orzih commented 3 years ago

Hi kittiu. This plugin is not control line breaks. However, you can use custom_template_path option and custom cover.html.

e.g.

  1. edit mkdocs.yml
    plugins:
      - search
      - with-pdf:
          custom_template_path: custom_pdf
  2. create custom_pdf directory on same place mkdocs.yml, and create custom_pdf/cover.html.j2. samples default_cover.html.j2

...and put 'custom_pdf/styles.scss' if you want.

bmewes commented 2 years ago

Hi orzih, Hi kittiu,

after nearly one year it is also still relevant to find a way editing the cover page for our documentation with a two lined subtitle. Our way getting that result we put two lines inside the

element in the cover.html.j2 file ([repository]\overrides\pdf) as follows:

<div class="wrapper">
        <h1>{{ cover_title | e }}</h1>
        <p>No.: 1.7</p>
        <p>Ed.: Henry Bowers</p>
</div>

And we got that as subtitle on our documentation's cover page: image

I think that was a suitable solution for editing the cover page as it is not possible to make a line break in the mkdocs.yml file.