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

--shift-heading-level-by=-1 doesn't promote the first H1 of djot input #10459

Closed
silby opened this issue Dec 14, 2024 · 1 comment
Closed

--shift-heading-level-by=-1 doesn't promote the first H1 of djot input #10459

silby opened this issue Dec 14, 2024 · 1 comment
Labels

Comments

@silby
Copy link
Contributor

silby commented Dec 14, 2024

Explain the problem.

I get this:

$ pandoc -s --shift-heading-level-by=-1 -f djot -t native
# hi
^D
Pandoc
  Meta { unMeta = fromList [] }
  [ Div ( "hi" , [ "section" ] , [] ) [ Para [ Str "hi" ] ] ]

I expected it to match this, as documented:

$ pandoc -s --shift-heading-level-by=-1 -f markdown -t native
# hi
^D
Pandoc
  Meta
    { unMeta =
        fromList [ ( "title" , MetaInlines [ Str "hi" ] ) ]
    }
  []

Pandoc version?
pandoc 3.6 on OpenBSD -current

@silby silby added the bug label Dec 14, 2024
@silby silby changed the title --shift-heading-level-by doesn't do the metadata thing with djot input --shift-heading-level-by=-1 doesn't promote the first H1 of djot input Dec 16, 2024
@jgm
Copy link
Owner

jgm commented Dec 17, 2024

See https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Transforms.hs#L151-L158

This shift is triggered by a document that starts with a Header 1; Djot puts the Div around the header, so it doesn't match. I suppose we could special-case this.

@jgm jgm closed this as completed in 7cff359 Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants