jgm/pandoc

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

silby opened this issue · 1 comments

silby commented

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

jgm commented

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.