pagebreak in markdown while creating pdf

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



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?





Did you have a go at code like: My Main Page #mainpage ============ This is the text on the first page latexonly newpage endlatexonly This is the text on the second page
– albert
Mar 24 '14 at 17:32






@albert I didn't find any mainpage keyword in latex folder
– user2760375
Mar 25 '14 at 3:56





The example I gave generates a mainpage consisting of 2 pages. The important part for you would be latexonly ....endlatexonly. When you place my example in a file (e.g. aa.md) you can see the 2 pages when you generated the latex output.
– albert
Mar 25 '14 at 17:31





@albert yeah now I got it earlier I didn't use the latexonly command in text file .Now I got it thanks
– user2760375
Mar 26 '14 at 3:57




4 Answers
4



I encountered the same and solve it by inserting



pagebreak



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





this works well with pandoc. inserts a page break in the latex pdf without interfering with the html rendering.
– Joel Ostblom
Apr 20 '15 at 19:36






Yeah Later I had to use pagebreak
– user2760375
Apr 21 '15 at 10:28





thx, I was just looking for that :) It works in R's knit tool too.
– Tetlanesh
Sep 20 '15 at 14:58




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.





This is the correct answer. These kind of style 'hacks' is probably why John accepted HTML/CSS
– CousinCocaine
Jul 26 '17 at 8:08






This is the correct answer. And it works with daring fireballs Markdown well
– Dimitry K
Dec 19 '17 at 10:46



> 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.


<blockquote>



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


<br>



123 Fake Street␣␣
Springfield, USA



becomes



123 Fake Street

Springfield, USA



Since the original specification Markdown was designed for HTML output (which doesn't have the concept of pages) there is no support for page breaks.



Doxygen uses LaTeX to generate its PDFs. It doesn't seem to support inline LaTeX¹, but you should be able to modify the intermediate .tex file and then use pdflatex to generate your PDF:


.tex


pdflatex


.tex


.tex


newpage


pdflatex documentation.tex


documentation.pdf



This question may be a useful reference for step 3 above.



¹Doxygen does support inline LaTeX formulas, but I wasn't able to find any mention of arbitrary inline LaTeX commands like newpage that operate in the text environment.


newpage





Hey Initially I went through .tex file approach , though I wanted to use pure markdown approach for pdf generation anyway and yes I also tried newpage but that didn't work .
– user2760375
Mar 24 '14 at 12:46






There is no pure Markdown approach since Markdown doesn't include syntax for page breaks. Although there are many Markdown extensions, I am not aware of any that add support for page breaks. You could try something like Pandoc which supports inline LaTeX, but I imagine you're using Doxygen for its ability to extract documentation blocks from source code, which Pandoc doesn't do. Maybe I'm wrong about that...
– Chris
Mar 24 '14 at 12:50



A last resource workaround is to manually edit the HTML output to render to PDF as you want.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS