Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing border_width in YAML theme file has no effect on admonition block borders #444

Closed
royemmerich opened this issue May 17, 2016 · 5 comments
Assignees
Milestone

Comments

@royemmerich
Copy link

royemmerich commented May 17, 2016

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?

@royemmerich royemmerich changed the title Changing border_width in YAML theme file has no effect Changing border_width in YAML theme file has no effect on admonition block borders May 17, 2016
@royemmerich
Copy link
Author

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.

@royemmerich
Copy link
Author

royemmerich commented May 17, 2016

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.

@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Aug 7, 2016
@mojavelinux mojavelinux self-assigned this Aug 7, 2016
@mojavelinux
Copy link
Member

mojavelinux commented Oct 5, 2016

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.

@mojavelinux
Copy link
Member

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.

@mojavelinux
Copy link
Member

mojavelinux commented Mar 8, 2017

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.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 28, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 28, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 28, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 28, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 28, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 30, 2019
@mojavelinux mojavelinux modified the milestones: v1.5.0, v1.5.0.rc.1 Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants