Two-line title in YAML header in .pdc file

I am using a YAML header for my .pdc (pandoc) source files. I wish to have a two-line title and have tried:

(a) title: “First Line
Second Line”
(b) title: |
| First Line
| Second Line
© title: “First Line
Second Line”

where there are two spaces after “First Line” in ©. But none of these seems to be picked up and I do not see two lines in the title.

Can someone please tell me what is going on and how to workaround it.

I wouldn’t expect two-line titles to be supported. A title should be one line by definition - it becomes the title of a browser tab, the name of a bookmark, and so on.
You might need to add your own field in the YAML meta and process it in the way that you want the “two-line” title to behave.

Can you provide an example of why you want a two-line title in the first place?

I would create a separate param called subtitle and use that in your templates.

{{if .Params.subtitle}}<hgroup>{{end}}
  <h1>{{.Title}}</h1>
  {{with .Params.subtitle}}<h1 class="subtitle">{{.}}</h1>{{end}}
{{if .Params.subtitle}}</hgroup>{{end}}
2 Likes

Example:

“Anatomy of Essay Writing:
From Thoughts to Printed Words”

That indeed looks like something best resolved with b_rad’s subtitle idea.

Or, if all your titles need line breaks after the same character (like : in your example), you could probably use some frontend trick to make them display so. But this is just a workaround.

On a side note, the following isn’t really accessible and the use of <hgroup> is debatable (see: MDN on hgroup and W3 on Subheadings, subtitles, alternative titles and taglines )

could you do something like:

<heading>
  <h1>{{ .Title }}</h1>
  {{- with .Params.subtitle -}}
      <p class="subtitle">{{ . }}</p>
  {{- end -}}
</heading>

regardless, this should be compliant – semantically and accessibility-wise.

This article from CSS Tricks is a good read. Nothing is set in stone of course, and there are lots of competing interests (screen-readers, SEO, etc.).

Yes, the outline algorithm hasn’t been implemented by any browsers yet, but a couple things to note.

the following isn’t really accessible

  1. If it is properly implemented in the underlying technology, it should make the content more accessible to let the user know that the title is grouped with subheadings, subtitles or taglines. I believe that is one of the primary reasons for hgroup. Additionally, using a p element will look much different in a text browser.

the use of <hgroup> is debatable

  1. Not as much as you may think. As you can see in the link you sent, the date of the HTML 5.2 spec is 2017-12-14. W3C no longer maintains the HTML spec as they reached an agreement with WHATWG in 2019. WHATWG is the official HTML spec as you can see by clicking on the link under Latest published version of HTML here:

    HTML Standard

    WHATWG still includes hgroup and uses it in many examples, and therefore it is part of the official spec. The information on MDN appears to simply be either outdated, or questionable regarding hgroup, but either way you can still use their suggestions just fine as you did in your example.