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

Duplicate class for unnumbered headers in HTML #6062

Closed
marrus-sh opened this issue Jan 11, 2020 · 1 comment · Fixed by sthagen/jgm-pandoc#35
Closed

Duplicate class for unnumbered headers in HTML #6062

marrus-sh opened this issue Jan 11, 2020 · 1 comment · Fixed by sthagen/jgm-pandoc#35

Comments

@marrus-sh
Copy link

marrus-sh commented Jan 11, 2020

When I type:

echo '[Header 1 ("section",["unnumbered"],[]) [Str "1"]]' | pandoc -f native -t html

I get:

 <h1 class="unnumbered" id="section" class="unnumbered">1</h1>

As you can see, the class attribute is listed twice, which is bad.

pandoc 2.9.1.1
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3

(macOS 10.15.2; installed via homebrew)

@jgm jgm added the bug label Jan 12, 2020
@jgm jgm added this to the next release milestone Jan 12, 2020
@jgm
Copy link
Owner

jgm commented Jan 12, 2020

Diagnosis: When makeSections creates the Divs dividing the document into sections, it sets the same classes on the Div as on the Header. But then line 1647 of src/Text/Pandoc/Writers.HTML,

              t <- addAttrs opts attr header'

ends up adding the attribute again.

The problem extends to all classes and key/value pairs:

echo '[Header 1 ("section",["foo","unnumbered"],[("key","val")]) [Str "1"]]' | pandoc -t html -f native
("section",["foo","unnumbered"],[("key","val")])
<h1 class="foo unnumbered" data-key="val" id="section" class="foo unnumbered" data-key="val">1</h1>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants