How to format Confluence properly that structure of space after export to PDF is valid with functional headings?

Petr October 17, 2016

Hello, I have one old problem which I am still not able to solve regarding headings numbering. I use this code: 

body {counter-reset: h2}
  h2 {counter-reset: h3}
  h3 {counter-reset: h4}
  h4 {counter-reset: h5}
  h5 {counter-reset: h6}

  h2:before {counter-increment: h2; content: counter(h2) ". "}
  h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "}
  h4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "}
  h5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
  h6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "}

  h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before { content: ""; counter-increment: none }

And as I have been told before, the code is valid. The problem of broken numbering is in the structure of the Confluence space. 

How does problem looks like: It counts and writes in the heading numbering but it usually start from 0 and stick with that for rest of the document. 

Several people has been editing context of the space therefore the formatting is highly inconsistent. Sometimes is everything written in bold, sometimes is used h1, sometimes h3 etc. Could you please give me an advice how to properly format whole document so headings would be functional? 

I know, that I have to mark titles like a specific <hx> tags, but I want to make sure I know how does it work before I actually start. 

So far I was working with this approach: Every title in tree structure is some hx tags. Therefore:

-RootTitle =    H1
--SubRoot =   H2
--SubRoot2 = H2 

etc. 

Therefore If I have 6 titles on level H2, then I should have something like: 1.1, 1.2. ...1.6. and those should be roots of their descendant. Unfortunately I am getting headings more less in this style: 1., 1.0.1, 1.0.0.1, 2., 2.0.1., 2.0.0.0.1.

So as you can see structure it kinda messed up. But. These headings are getting automatic from the space hierarchy / tree structure, right? So formatting of one specific page / article should not affect it. 

Thanks for help. 

1 answer

1 vote
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2016

Just another reason I don't believe in heading numbering -  so 90s wink

I would suggest going to the commercial PDF plugin from Scroll (K15t). There export engine goes through a hierarchy leveling process as it processes child pages. And getting numbered headings out is fairly straightforward. Yes it costs money, but it will save a lot of frustration.

Otherwise, you may have to do some counter resetting to 1 in places to get it to work properly. I have had to do some of this trickery of even setting counters to -1 to get it to work right for other CSS output.

body {counter-reset: h2 1}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events