Skip to content
Discussion options

You must be logged in to vote

If anyone reading this wants to know how to get this done, either:

  1. delete all instances of # title, or
  2. Use this lua filter (adapted from @tarleb's lua filter here)
local title

-- Set title from level 1 header, or
-- discard level 1 header if title is already set.
function promote_header_title (header)

  if header.level >= 2 then
    return header
  end

  if not title then
    title = header.content
    return {}
  end

  local msg = '[WARNING] title already set; discarding header "%s"\n'
  io.stderr:write(msg:format(pandoc.utils.stringify(header)))
  return {}
end

return {
  {Meta = function (meta) title = meta.title end}, -- init title
  {Header = promote_header_title},
  {Meta = f…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mcanouil
Comment options

mcanouil Sep 7, 2023
Collaborator

Comment options

You must be logged in to vote
0 replies
Answer selected by the-solipsist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants