Outline Numbering OK in Preview But Heading 3, 4 Not Honoured in Export as PDF

nic's Avatar

nic

23 May, 2020 10:28 AM

I have an outline decimal heading numbering schema applied via CSS. Workd perfectly in Preview. On File | Export as PDF it fails to increment at heading levels 3 and 4 (I haven't tried any lower than this).

For some reason when exported as a PDF the counters for heading levels 3 and 4 aren't incremented and remain at 1.

Any ideas on what is causing this?

  1. Support Staff 1 Posted by Brett on 23 May, 2020 02:58 PM

    Brett's Avatar

    This is a known issue that's been a headache for a while now. I haven't
    been able to determine why the CSS counters fail to increment in print
    media (including PDF) with the same markup as the display version. While
    I'm still looking into this, I do not have a workaround at the present
    time.

    I'll test further with the provided document. Could you also include the
    configuration details provided by Help->Report an Issue?

    -Brett

  2. Support Staff 2 Posted by Brett on 23 May, 2020 03:01 PM

    Brett's Avatar

    In Preferences->General, do you have Headlines Collapse Sections
    enabled, or disabled?

    Thanks,
    Brett

  3. Support Staff 3 Posted by Brett on 23 May, 2020 03:04 PM

    Brett's Avatar

    Oh, and are you applying your own decimal outline, or using the Outline
    Mode->Decimal that's built into Marked? If you're applying your own,
    I'll need you to provide your custom CSS for that as well.

    -Brett

  4. 4 Posted by nic on 23 May, 2020 04:41 PM

    nic's Avatar

    Under Preview I've got 'Headlines collapse sections' enabled

  5. 5 Posted by nic on 23 May, 2020 04:43 PM

    nic's Avatar

    My own:

    /* heading numbering - decimal outline
    https://www.w3schools.com/css/css_counters.asp */
    body {
        counter-reset: L1;
    }

    h1.nocount:before{
        content:"";
        counter-reset: L1;
    }

    h1:before {
        content: counter(L1) ". ";
        counter-increment: L1; /* add 1 to level 1 heading */
    }
    h1 {
        counter-reset: L2; /* set level 2 heading to 0 */
    }

    h2:before {
        content: counter(L1) "." counter(L2) " ";
        counter-increment: L2; /* add 1 to level 2 heading */
    }
    h2 {
        counter-reset: L3; /* set level 3 heading to 0 */
    }

    h3:before {
        content: counter(L1) "." counter(L2) "." counter(L3) " ";
        counter-increment: L3; /* add 1 to level 3 heading */
    }
    h3 {
        counter-reset: L4; /* set level 4 heading to 0 */
    }

    h4:before {
        content: counter(L1) "." counter(L2) "." counter(L3) "." counter(L4) " ";
        counter-increment: L4; /* add 1 to level 4 heading */
    }
    h4 {
        counter-reset: L5; /* set level 5 heading to 0 */
    }

    which works fine in Preview.

  6. Support Staff 6 Posted by Brett on 23 May, 2020 04:47 PM

    Brett's Avatar

    If you disable Headers Collapse Sections does the problem go away?

    Thanks,
    Brett

  7. 7 Posted by nic on 23 May, 2020 06:33 PM

    nic's Avatar

    I'm ahead of you - unfortunately, no.

  8. Support Staff 8 Posted by Brett on 25 May, 2020 02:27 PM

    Brett's Avatar

    Ok, you're running into the unsolved bug from before (which exists
    somewhere on this forum, I'd have to search for it). It's a true
    mystery, especially considering that the built-in outline format, which
    uses the same concept, exports fine. I'll look further into it, but at
    this time I have no solution. I know that's a drag, I'm truly sorry I
    haven't been able to solve this one yet.

    -Brett

  9. 9 Posted by nic on 26 May, 2020 06:36 PM

    nic's Avatar

    OK

    The reason I went down this route is because the standard decimal outline offered by the gear whee; numbers not only headings but paragraphs and bulleted lists - I wanted just an outline structure applied to headings only. As a work-around is this possible to implement via the gear wheel outline method?

  10. Support Staff 10 Posted by Brett on 27 May, 2020 02:40 PM

    Brett's Avatar

    What's weird is that the built-in outlining just uses a more complex
    version of the same method (to account for paragraph and list item
    numbering as well as headlines). It would be futile for me to implement
    your setup on my end, as there's no combination that would cover
    everyone's desires for headline numbering. I just need to figure out why
    the counter increments for my version, but not for a manual override
    version.

    I wonder if using some !important rules on the counter-increments your
    custom CSS might make a difference. I'll explore it, but feel free to
    test on your end if you have the time.

    I still don't have an immediate solution for you, though.

    -Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Test.md 1.5 KB
  • Test_in_Preview.jpg 239 KB
  • Test_Export_Aa_PDF.pdf 16.8 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac