Skip to content

With Pandoc 2.8, attributes are added to the header element instead of its parent when --section-divs is enabled #5965

@yihui

Description

@yihui

I noticed a change in Pandoc 2.8 (which might be from 9f984ff), but I'm not sure it is intended. Before 2.8, attributes of a header are added to its parent div (or section) when --section-divs is enabled, such as the class attribute:

$ pandoc -t html4 --section-divs <<< "# Hello {.foo}" 

<div id="hello" class="section level1 foo">
<h1>Hello</h1>
</div>

With 2.8+, the class attribute is added to h1:

$ pandoc -t html4 --section-divs <<< "# Hello {.foo}" 

<div id="hello" class="section level1">
<h1 class="foo">Hello</h1>
</div>

(Note that the id attribute is still on the div instead of h1, though.)

We have plenty of (R Markdown) applications that depend on the previous behavior, i.e., the class attribute being added to the parent div instead of the header itself. For example, previously we could style a whole section by defining CSS rules for .foo { }. Now these rules are only applied to the header elements. We also have JavaScript applications that rely on this behavior. I wonder if there is a chance to restore the old behavior. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions