-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Empty title warning and disappearing metadata with --shift-heading-level-by #5957
Comments
The option that most closely corresponds with But it also moves the metadata title up to a level 1 heading, and depopulates the metadata title, which I see isn't good for you. (And I'd imagine your case is a fairly normal one.) @mb21 @DanielSWolf maybe you have some thoughts on what should be done? |
Yeah, guess that's a good solution... |
With positive heading shifts, starting in 2.8 this option caused metadata titles to be removed and changed to regular headings. This behavior is incompatible with the old behavior of `--base-header-level` and breaks old workflows, so with this commit we are rolling back this change. Now, there is an asymmetry in positive and negative heading level shifts: + With positive shifts, the metadata title stays the same and does not get changed to a heading in the body. + With negative shifts, a heading can be converted into the metadata title. I think this is a desirable combination of features, despite the asymmetry. One might, e.g., want to have a document with level-1 section headigs, but render it to HTML with level-2 headings, retaining the metadata title (which pandoc will render as a level-1 heading with the default template). Closes jgm#5957. Revises jgm#5615.
I am using pandoc 2.8.0.1.
Here is the Markdown document I am using (
blah.md
):and here is my template (
t.html
):The desired behavior is for "my post" to appear both in the
<title>
tag as well as the<h1>
, and for "first section" and "second section" to be<h2>
. This used to be accomplished by setting--base-header-level=2
. Here is the desired output, using pandoc 2.7.3 (pandoc -f markdown -t html5 --template=t.html blah.md -o blah.html --base-header-level=2
):On the other hand, with pandoc 2.8.0.1 here is what I get with different values of
--shift-heading-level-by
:pandoc -f markdown -t html5 --template=t.html blah.md -o blah.html --shift-heading-level-by=0
("first section" and "second section" are
<h1>
rather than<h2>
)pandoc -f markdown -t html5 --template=t.html blah.md -o blah.html --shift-heading-level-by=1
(the
<title>
is "blah" rather than "my post", and there is an empty<h1>
)I also get a warning:
pandoc -f markdown -t html5 --template=t.html blah.md -o blah.html --shift-heading-level-by=2
(the
<title>
is "blah" rather than "my post", empty<h1>
, and all headings are wrong)Again, I get the warning:
pandoc -f markdown -t html5 --template=t.html blah.md -o blah.html --shift-heading-level-by=-1
(
<title>
is "first section", "second section" is not a heading, "my post" disappears)I've also noticed that metadata can sometimes disappear in the output. For example, when compiling with
pandoc -f markdown -t html5 --standalone blah.md -o blah.html --shift-heading-level-by=1
(i.e. using the default pandoc template, nott.html
), the author name ("alice") does not appear in the HTML output. This appears to be because of the way the author block is wrapped around$if(title)$
.I may be misunderstanding how the new
--shift-heading-level-by
option works. The release notes state "The new option does everything the old one does, but also allows negative shifts". If there is some simple way to obtain the pandoc 2.7.3 behavior, I would like to know.The text was updated successfully, but these errors were encountered: