Skip to content

pandoc does not set <title> despite emitting Defaulting to '<basename>' as the title. #9370

Closed
@ThomasSoeiro

Description

@ThomasSoeiro

When writing to a (custom) html template, pandoc does not set <title> despite emitting Defaulting to '<basename>' as the title.

However, I am glad with the current behaviour (i.e. warn that a title is needed + not setting the title + advice on how to set the title using pandoc). I think setting the title automatically would be too invasive (e.g. I want to set the title later using js).

template.html:

<!DOCTYPE html>
<html>
  <head>
    <title></title>
  </head>
  <body>
      $body$
  </body>
</html>

source file:

echo hello world > test.md

convert to html:

pandoc -f commonmark -t html5 --template=template.html test.md
[WARNING] This document format requires a nonempty <title> element.
  Defaulting to 'test' as the title.
  To specify a title, use 'title' in metadata or --metadata title="...".
<!DOCTYPE html>
<html>
  <head>
    <title></title>
  </head>
  <body>
      <p>hello world</p>
  </body>
</html>
pandoc -v
pandoc 3.1.11.1
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: C:\Users\A141800\AppData\Roaming\pandoc
Copyright (C) 2006-2023 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions