Husky
Husky

Reputation: 1

How to add background color to headings in AsciiDoctor-pdf PDF output

I have a custom pdf-theme to style the headings in pdf export from asciidoc like this:

extends: default
...

heading:
  h2-font-color: [ 100%, 100%, 100%, 0 ]
  h2-font-family: ArialBlack
  h2-font-style: normal
  h2-font-size: 13
  h2-border-width: [1, 1, 1, 1]
  h2-border-color: #FF0000

This creates a red frame.

Is there a way to specify the background color for specific headers like h2? h2-background-color does not work.

Increasing the border width to e.g. 10 would fill the box, but it is in front of the text..

But I need a filled red rectangle with black text in front.

h2-background-color does not work or even does not exist

Is there a way to specify the background color for specific headers like h2?

Upvotes: 0

Views: 172

Answers (1)

eskwayrd
eskwayrd

Reputation: 4521

No. Asciidoctor PDF's theming capability does not include the ability to set a background for a heading.

However, you could implement an extended converter to customize the heading presentation using Prawn directives. Prawn is the PDF generation library that Asciidoctor PDF uses.

The documentation has many examples of extending the converter to customize the PDF output. In the last section of that page, called "Resources", there is a link to a repo with a custom heading implementation that might be useful as inspiration.

Upvotes: 0

Related Questions