Asciidoctor-pdf: Changing border_width in YAML theme file has no effect on admonition block borders

Created on 17 May 2016  路  5Comments  路  Source: asciidoctor/asciidoctor-pdf

Version

$ asciidoctor-pdf -V
Asciidoctor PDF 1.5.0.alpha.11 using Asciidoctor 1.5.4 [http://asciidoctor.org]
Runtime Environment (ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

My Wish

I want to add a border (and background colour) to the admonition blocks in my PDF output.

What I've Tried

The admonition section of my YAML theme file looks like this:

admonition:
  background_color: f5f5f5
  border_color: 7d7d7d
  border_width: $base_border_width
  padding: [0, $horizontal_rhythm, 0, $horizontal_rhythm]
  • background_color has no effect (I added that).
  • changing border_colorchanges the colour of the vertical separator line between the icon and the text.
  • changing border_width doesn't have the desired effect. I've altered this value to 5but:

    • no external border appears around the admonition block and

    • the width of the vertical separator line between the icon and the text doesn't change either.

The only way I've managed to achieve anything near to what I'm hoping for is by enclosing my admonitions in a sidebar block as such:

****
[NOTE]
====
This is a note admonition block enclosed in a sidebar block +
which seems like a bit of a hack to achieve my wish.
====
****

Question

Any tips on how to achieve my wish?

enhancement

All 5 comments

Going through the Ruby code it seems this is the offending line:

https://github.com/asciidoctor/asciidoctor-pdf/blob/master/lib/asciidoctor-pdf/converter.rb#L433

The bounding box border is set to 0:

bounding_box [0, cursor]

From the comments in the code it looks like the admonition block formatting is filled with FIXME HACKs so I tentatively ask whether this change is wise?

I'll give it a whirl on my side and see how it goes.

I tried adding stroke_bounds at various points in the def convert_admonition node function but only weird stuff happened. Bounding boxes appeared around the icons or the whole page!

As this is my first foray into Ruby and Prawn I'll wait for some wiser folk to chirp up. Maybe I'll pluck up the courage to dig a bit deeper.

We should also add the option to set a background color, which happens to be part of the same implementation.

Being able to set a surrounding border and background color is closely related #362 and #259.

It's now possible to control the width of the vertical line between the label / icon and the content.

https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#keys-admonition

It's now called column_rule so as not to confuse it with a border around the block, which is not yet implemented.

The focus of this issue is to add a border around the whole block.

The request to set the background color should be filed as a separate issue if it cannot be implemented at the same time. I'll wait until this issue has a proposed solution before opening that other issue.

Was this page helpful?
0 / 5 - 0 ratings