Pagebreak in Markdown While Creating Pdf

Pagebreak in Markdown While Creating Pdf

I am creating a pdf of markdown text file using doxygen (1.8.6). Now I want to get page break at specific stage in markdown file, I used this link.

In the given link they have mentioned to use '>' for line break. But they haven't mentioned about page break. Yes I can use '>' for page break as well but I have to write this symbol 5 or more times on markdown text file and that makes markdown file in weird look. Is there any other ways to get page breaks in markdown files?

4

8 Answers

Since Markdown accepts plain HTML and CSS, simply add this line wherever you want to force page break.

<div style="page-break-after: always;"></div>

If your Markdown editor have trouble exporting PDF correctly, first try to export as HTML, then open with your browser and print as PDF.

6

I encountered the same and solve it by inserting

\pagebreak

It's actually a LaTeX command, rather than a Markdown one.

5

I Know that this is a dead question, but I've found a way that I think can be useful for other than me.

You can use the command \pagebreak inside an invisible element. In this way it works with latex and with html.

<div style="page-break-after: always; visibility: hidden"> 
\pagebreak 
</div>
2

Blockquotes vs. line breaks

> is not used for line breaks in Markdown. It's used for blockquotes. For example, the following Markdown code

> A man provided with paper, pencil, and rubber, and
> subject to strict discipline, is in effect a universal machine.

becomes

A man provided with paper, pencil, and rubber, and subject to strict discipline, is in effect a universal machine.

(This is a quote from Alan Turing.)

Note how it is rendered with a yellow background by Stack Overflow. If you examine the generated markup you will find <blockquote> tags being used.

Line breaks can usually be inserted by ending a line with two or more spaces (Markdown syntax) or by using raw <br> tags (most Markdown processors allow inline HTML). For example (using ␣ to represent a space), this Markdown

123 Fake Street␣␣
Springfield, USA

becomes

123 Fake Street
Springfield, USA

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.