asciidoctor-pdf theming of heading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

asciidoctor-pdf theming of heading

simpligility
Hi,

I am using asciidoctor-pdf with a custom theme successfully and would like to have each top level chapter start at the top of a new page. I could not find anything on how to achieve this. Is this currently possible and I am just overlooking it or would that be a feature request..

thx
Ted
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

Ted
Use experimental attribute and the page break syntax

= Page Breaks in PDF
:icons: font
:experimental:

include::Chapter1.adoc[]

<<<

include::Chapter2.adoc[]

<<<

include::Chapter3.adoc[]


Then render AsciiDoc as pdf

 $ asciidoctor-pdf PageBreaksInPDF.adoc



----------------------------------------------------------------------------------
ref: http://asciidoctor.org/docs/user-manual/#page-break

- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

simpligility

Great Ted. That works. 

I would rather be able to declare that in the theme somehow and not make it part of the actual document but this will do for now. Should I file a ticket to allow something like this in the theme? 

Manfred

Ted [via Asciidoctor :: Discussion] wrote on 2016-07-28 10:26:

Use experimental attribute and the page break syntax

= Page Breaks in PDF
:icons: font
:experimental:

include::Chapter1.adoc[]

<<<

include::Chapter2.adoc[]

<<<

include::Chapter3.adoc[]


Then render AsciiDoc as pdf

 $ asciidoctor-pdf PageBreaksInPDF.adoc

ref: http://asciidoctor.org/docs/user-manual/#page-break
 
- Ted @TedAtCIS
 
If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-theming-of-heading-tp4842p4843.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from asciidoctor-pdf theming of heading, click here.
NAML
Ted
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

Ted
This post was updated on .
simpligility wrote
I would rather be able to declare that in the theme somehow and not make it part of the actual document but this will do for now.
Manfred,

Take a look at the HTML the 'page break' syntax generates. You get this nice div:

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

In your project you could inject the style into your end of chapter or before start of new chapter.
But either way you're going to need an HTML element to hang that on.

Perhaps if your chapters start with an H2, in your theme you could add H2 {page-break-before: always;} to the CSS and it would work?

If that doesn't work, you could dig thru the repo. Somewhere buried in https://github.com/asciidoctor/asciidoctor-pdf you could dredge up how the PDF converter uses the CSS code that acts on that style "page-break-after: always;"

simpligility wrote
Should I file a ticket to allow something like this in the theme?
No, since theoretically you might be able to accomplish it with your theme.

Personally I would just use the page break.

If you get your page breaks to work in your theme, please let us know.
- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

simpligility

Ted,

I am, at this stage, not concerned with HTML at all. I could certainly hack a CSS to achieve what I want in HTML. Thanks for the details on the produced HTML.

The interesting observation though from my end is that you seem to indicate that the asciidoctor-pdf transforms the HTML (or CSS code) somehow. I thought it goes straight from asciidoc format to PDF. What am I missing? 

Manfred

Ted
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

Ted
You are probably right.

That was a huge assumption on my part.  I don't know how it actually renders the PDF.

- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf theming of heading

mojavelinux
Administrator
In reply to this post by simpligility

On Thu, Jul 28, 2016 at 11:01 AM, simpligility [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am using asciidoctor-pdf with a custom theme successfully and would like to have each top level chapter start at the top of a new page.

This is the default behavior in Asciidoctor PDF if you set the doctype to book.

There's also an open request to make this behavior configurable using the theme.


Cheers,

-Dan


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux